Skip to content

Commit bbe2c45

Browse files
committed
simplify and expand viewer.Product doctest
1 parent 8b21c8a commit bbe2c45

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

larray/viewer.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -301,20 +301,19 @@ class Product(object):
301301
302302
Examples
303303
--------
304-
>>> age = [10, 11, 12]
305-
>>> time = [2007, 2008, 2009]
306-
>>> cart_prod = Product([age, time])
307-
>>> for i in range(len(cart_prod)):
308-
... print(cart_prod[i])
309-
(10, 2007)
310-
(10, 2008)
311-
(10, 2009)
312-
(11, 2007)
313-
(11, 2008)
314-
(11, 2009)
315-
(12, 2007)
316-
(12, 2008)
317-
(12, 2009)
304+
>>> p = Product([['a', 'b', 'c'], [1, 2]])
305+
>>> for i in range(len(p)):
306+
... print(p[i])
307+
('a', 1)
308+
('a', 2)
309+
('b', 1)
310+
('b', 2)
311+
('c', 1)
312+
('c', 2)
313+
>>> p[1:4]
314+
[('a', 2), ('b', 1), ('b', 2)]
315+
>>> list(p)
316+
[('a', 1), ('a', 2), ('b', 1), ('b', 2), ('c', 1), ('c', 2)]
318317
"""
319318
def __init__(self, arrays):
320319
self.arrays = arrays

0 commit comments

Comments
 (0)