Message151717
| Author |
terry.reedy |
| Recipients |
ezio.melotti, ncoghlan, terry.reedy, yak |
| Date |
2012年01月21日.04:03:29 |
| SpamBayes Score |
0.0003757951 |
| Marked as misclassified |
No |
| Message-id |
<1327118610.71.0.185139816508.issue13814@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Calling g.close() is pointless for a generator used in normal pull mode and run to completion, as in the example. The generator is already 'closed', so g.close() does not do anything useful. See
http://docs.python.org/py3k/reference/expressions.html#yield-expressions
The method was added to be used with .send() so that generators used in push mode could be told to finish up when there is nothing more to send. For such rare uses, contextlib.closing should usually be sufficient, I think.
So I think this issue should be closed. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年01月21日 04:03:30 | terry.reedy | set | recipients:
+ terry.reedy, ncoghlan, ezio.melotti, yak |
| 2012年01月21日 04:03:30 | terry.reedy | set | messageid: <1327118610.71.0.185139816508.issue13814@psf.upfronthosting.co.za> |
| 2012年01月21日 04:03:30 | terry.reedy | link | issue13814 messages |
| 2012年01月21日 04:03:29 | terry.reedy | create |
|