[Python-Dev] Re: anonymous blocks

Paul Moore p.f.moore at gmail.com
Thu Apr 21 10:38:52 CEST 2005


On 4/20/05, 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

And, of course, PEP 310 is all about encapsulating before/after
(acquire/release) actions.

Paul.


More information about the Python-Dev mailing list