@@ -1894,14 +1894,24 @@ are always available. They are listed here in alphabetical order.
18941894 >>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))
18951895 [('a', 1), ('b', 2), ('c', 3)]
18961896
1897- Unlike the default behavior, it checks that the lengths of iterables are
1898- identical, raising a :exc: `ValueError ` if they aren't:
1899-
1900- >>> list (zip (range (3 ), [' fee' , ' fi' , ' fo' , ' fum' ], strict = True ))
1897+ Unlike the default behavior, it raises a :exc: `ValueError ` if one iterable
1898+ is exhausted before the others:
1899+
1900+ >>> for item in zip (range (3 ), [' fee' , ' fi' , ' fo' , ' fum' ], strict = True ): # doctest: +SKIP
1901+ ... print (item)
1902+ ...
1903+ (0, 'fee')
1904+ (1, 'fi')
1905+ (2, 'fo')
19011906 Traceback (most recent call last):
19021907 ...
19031908 ValueError: zip() argument 2 is longer than argument 1
19041909
1910+ ..
1911+ This doctest is disabled because doctest does not support capturing
1912+ output and exceptions in the same code unit.
1913+ https://github.com/python/cpython/issues/65382
1914+
19051915 Without the ``strict=True `` argument, any bug that results in iterables of
19061916 different lengths will be silenced, possibly manifesting as a hard-to-find
19071917 bug in another part of the program.
0 commit comments