sequence

topleveltools.sequence(items=None, **keywords)

Makes sequence or sequence expression.

Makes sequence:

>>> sequence([1, 2, [3, [4]], 5])
Sequence([1, 2, [3, [4]], 5])

Makes sequence expression:

>>> expression = sequence()
>>> expression([1, 2, [3, [4]], 5])
Sequence([1, 2, [3, [4]], 5])

Flattens, reverses and slices sequence:

>>> sequence_ = sequence([1, 2, [3, [4]], 5])
>>> sequence_
Sequence([1, 2, [3, [4]], 5])
>>> sequence_ = sequence_.flatten()
>>> sequence_
Sequence([1, 2, 3, 4, 5])
>>> sequence_ = sequence_.reverse()
>>> sequence_
Sequence([5, 4, 3, 2, 1])
>>> sequence_ = sequence_[-3:]
>>> sequence_
Sequence([3, 2, 1])
>>> expression = sequence()
>>> expression = sequence()
>>> expression = expression.flatten()
>>> expression = expression.reverse()
>>> expression = expression[-3:]
>>> expression([1, 2, [3, [4]], 5])
Sequence([3, 2, 1])

Returns sequence when items is not none.

Returns sequence expression when items is none.