[Python-Dev] Simpler finalization semantics (was Re: PEP 343 - Abstract Block Redux)
Guido van Rossum
gvanrossum at gmail.com
Wed May 18 03:01:04 CEST 2005
And we're back at PEP 310 and you can't really write opening() as a generator.
On 5/17/05, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Nick Coghlan wrote:
>
> > the_stmt = EXPR1
> > stmt_enter = getattr(the_stmt, "__enter__", None)
> > stmt_exit = getattr(the_stmt, "__exit__", None)
> >
> > if stmt_enter is None:
> > VAR1 = the_stmt
> > else:
> > VAR1 = stmt_enter()
>
> If we're doing this, it might be better if VAR were simply
> bound to EXPR in all cases. Otherwise the ability to liberally
> sprinkle with-statements around will be hampered by uncertainty
> about what kind of object VAR will end up being.
>
> Greg
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
>
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list