[Python-ideas] for line in input with open(path) as input...

Shane Green shane at umbrellacode.com
Sat Feb 2 15:05:19 CET 2013


*From:* Serhiy Storchaka <storchaka at gmail.com>
*Date:* February 2, 2013 5:50 AM
*To:* python-ideas at python.org
*Subject:* [Python-ideas] for line in input with open(path) as input...


When should iterwith() call __exit__()?

*From:* Shane Green <shane at umbrellacode.com>
*Date:* February 2, 2013 5:55 AM
*To:* Serhiy Storchaka <storchaka at gmail.com>
*CC:* python-ideas at python.org
*Subject:* [Python-ideas] for line in input with open(path) as input...
iterwith() doesn't need to: __exit__() is invoked automatically when 
iteration completes and the loop exits.

> I hadn't thought about the fact the context was created inside the 
> generator...  Nonetheless, cleanup would be automatic, always; and the 
> generator should exit eventually on close() if not exhausted, I 
> believe (need to review the details on gen cleanup).
>
>
>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130202/292c4602/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130202/292c4602/attachment.jpg>


More information about the Python-ideas mailing list