[Python-Dev] Re: anonymous blocks

Josiah Carlson jcarlson at uci.edu
Wed Apr 20 18:41:33 CEST 2005


Samuele Pedroni <pedronis at strakt.com> wrote:
> 
> 
> >
> >
> >    def do():
> >        print "setup"
> >        try:
> >            yield None
> >        finally:
> >            print "tear down"
> >
> > doesn't quite work (if it did, all you would need is syntactic sugar 
> > for "for
> > dummy in").
> >
> PEP325 is about that

PEP 288 can be used like that.

 - Josiah



More information about the Python-Dev mailing list