Message 91488 - Python tracker
Message91488
| Author | alexandre.vassalotti |
|---|---|
| Recipients | alexandre.vassalotti, georg.brandl, scoder |
| Date | 2009-08-11.21:58:23 |
| SpamBayes Score | 0.0003937405 |
| Marked as misclassified | No |
| Message-id | <1250027904.95.0.0238005941255.issue6673@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
Not a bug.
The list comprehension in your chunker:
while True:
target.send([ (yield) for i in range(chunk_size) ])
is equivalent to the following generator in Python 3:
while True:
def g():
for i in range(chunk_size):
yield (yield)
target.send(list(g()))
This clearly needs not what you want. So, just rewrite your code using
for-loop:
while True:
result = []
for i in range(chunk_size):
result.append((yield))
target.send(result) |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2009-08-11 21:58:25 | alexandre.vassalotti | set | recipients: + alexandre.vassalotti, georg.brandl, scoder |
| 2009-08-11 21:58:24 | alexandre.vassalotti | set | messageid: <1250027904.95.0.0238005941255.issue6673@psf.upfronthosting.co.za> |
| 2009-08-11 21:58:23 | alexandre.vassalotti | link | issue6673 messages |
| 2009-08-11 21:58:23 | alexandre.vassalotti | create | |