Message149403
The following self-referencing generator has incorrect output:
def ab_combinations():
#'', 'a', 'b', 'aa', 'ab', 'ba', 'bb', 'aaa', ...
def _deferred_output():
yield ""
tees = tee(output)
#This definition works fine: '', 'a', 'b', 'aa', 'ab', 'ba', ...
l = [(item+"a" for item in tees[0]), (item+"b" for item in tees[1])]
#This definition results in: '', 'b', 'b', 'bb', 'bb', 'bb', ...
#l = [(item+label for item in t) for t, label in zip(tees,"ab")]
while True:
for g in l:
yield next(g)
result, output = tee(_deferred_output())
return result |
|
Date |
User |
Action |
Args |
2011-12-13 19:25:40 | PyryP | set | recipients:
+ PyryP |
2011-12-13 19:25:40 | PyryP | set | messageid: <1323804340.16.0.941499228251.issue13595@psf.upfronthosting.co.za> |
2011-12-13 19:25:39 | PyryP | link | issue13595 messages |
2011-12-13 19:25:39 | PyryP | create | |
|