chainlet.primitives.compound module

Bases: chainlet.primitives.link.ChainLink

Baseclass for compound chainlets consisting of other chainlets

Parameters:elements (iterable[ChainLink]) – the chainlets making up this chain

These compound elements expose the regular interface of chainlets. They can again be chained or stacked to form more complex chainlets.

Any CompoundLink based on sequential or mapped elements allows for subscription:

len(link)

Return the number of elements in the link.

link[i]

Return the i’th chainlink of the link.

link[i:j:k]

Return a new link consisting of the elements defined by the slice [i:j:k]. This follows the same semantics as subscription of regular sequences.

bool(link)

Whether the link contains any elements.

chainlet_send(value=None)

Send a value to this element for processing

close()

Close this element, freeing resources and possibly blocking further interactions

elements