Skip to content

Commit c3b34f4

Browse files
committed
-
1 parent a3a238d commit c3b34f4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

source_py3/python_toolbox/combi/map_space.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ class MapSpace(sequence_tools.CuteSequenceMixin, collections.Sequence):
1818
This is similar to Python's builtin `map`, except that it behaves like a
1919
sequence rather than an iterable. (Though it's also iterable.) You can
2020
access any item by its index number.
21+
22+
Example:
23+
24+
>>> map_space = MapSpace(lambda x: x ** 2, range(7))
25+
>>> map_space
26+
MapSpace(<function <lambda> at 0x00000000030C1510>, range(0, 7))
27+
>>> len(map_space)
28+
7
29+
>>> map_space[3]
30+
9
31+
>>> tuple(map_space)
32+
(0, 1, 4, 9, 16, 25, 36)
33+
2134
'''
2235
def __init__(self, function, sequence):
2336

0 commit comments

Comments
 (0)