Message149403
| Author |
PyryP |
| Recipients |
PyryP |
| Date |
2011年12月13日.19:25:39 |
| SpamBayes Score |
0.0010161587 |
| Marked as misclassified |
No |
| Message-id |
<1323804340.16.0.941499228251.issue13595@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|
History
|
|---|
| 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 |
|