Language design

Chris Angelico rosuav at gmail.com
Wed Sep 11 00:21:14 EDT 2013


On Wed, Sep 11, 2013 at 11:46 AM, Chris Rebert <clp2 at rebertia.com> wrote:
> * The value of the loop variable at call-time for functions defined
> within a loop trips people up.

Related: The confusion of 'with' vs __del__ vs del wrt open files etc.
Using 'with' does not guarantee the object's destruction, but the
destruction of the object and the exiting of the with block do have
the same effect, which is confusing. Personally, I'd prefer a
guarantee that this name expires at this point, plus a guarantee that
- if there are no other references - the object will be cleaned up
immediately; it's generally true in CPython, and if that could
actually be made a language feature, there'd be no need for 'with' and
no issues with confusing people.

ChrisA



More information about the Python-list mailing list