File tree 2 files changed +8
-6
lines changed
2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -859,10 +859,11 @@ which incur interpreter overhead.
859
859
""" Variant of takewhile() that allows complete
860
860
access to the remainder of the iterator.
861
861
862
- >>> all_upper, remainder = before_and_after(str .isupper, ' ABCdEfGhI' )
863
- >>> str .join(' ' , all_upper)
862
+ >>> it = iter (' ABCdEfGhI' )
863
+ >>> all_upper, remainder = before_and_after(str .isupper, it)
864
+ >>> ' ' .join(all_upper)
864
865
'ABC'
865
- >>> str .join(' ' , remainder)
866
+ >>> ' ' .join(remainder) # takewhile() would lose the 'd'
866
867
'dEfGhI'
867
868
868
869
Note that the first iterator must be fully
Original file line number Diff line number Diff line change @@ -2646,10 +2646,11 @@ def test_permutations_sizeof(self):
2646
2646
>>> list(odds)
2647
2647
[1, 3, 5, 7, 9]
2648
2648
2649
- >>> all_upper, remainder = before_and_after(str.isupper, 'ABCdEfGhI')
2650
- >>> str.join('', all_upper)
2649
+ >>> it = iter('ABCdEfGhI')
2650
+ >>> all_upper, remainder = before_and_after(str.isupper, it)
2651
+ >>> ''.join(all_upper)
2651
2652
'ABC'
2652
- >>> str .join('', remainder)
2653
+ >>> '' .join(remainder)
2653
2654
'dEfGhI'
2654
2655
2655
2656
>>> list(powerset([1,2,3]))
You can’t perform that action at this time.
0 commit comments