Skip to content

Commit a3a238d

Browse files
committed
-
1 parent f399062 commit a3a238d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

source_py3/python_toolbox/combi/chain_space.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ class ChainSpace(sequence_tools.CuteSequenceMixin, collections.Sequence):
2020
2121
This is similar to `itertools.chain`, except that items can be fetched by
2222
index number rather than just iteration.
23+
24+
Example:
25+
26+
>>> chain_space = ChainSpace(('abc', (1, 2, 3)))
27+
>>> chain_space
28+
<ChainSpace: 3+3>
29+
>>> chain_space[4]
30+
2
31+
>>> tuple(chain_space)
32+
('a', 'b', 'c', 1, 2, 3)
33+
>>> chain_space.index(2)
34+
4
35+
2336
'''
2437
def __init__(self, sequences):
2538
self.sequences = nifty_collections.LazyTuple(

0 commit comments

Comments
 (0)