File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 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 @@ -2604,10 +2604,11 @@ def test_permutations_sizeof(self):
2604
2604
>>> list(odds)
2605
2605
[1, 3, 5, 7, 9]
2606
2606
2607
- >>> all_upper, remainder = before_and_after(str.isupper, 'ABCdEfGhI')
2608
- >>> str.join('', all_upper)
2607
+ >>> it = iter('ABCdEfGhI')
2608
+ >>> all_upper, remainder = before_and_after(str.isupper, it)
2609
+ >>> ''.join(all_upper)
2609
2610
'ABC'
2610
- >>> str .join('', remainder)
2611
+ >>> '' .join(remainder)
2611
2612
'dEfGhI'
2612
2613
2613
2614
>>> list(powerset([1,2,3]))
You can’t perform that action at this time.
0 commit comments