No macros in Python

Bernhard Herzog bh at intevation.de
Tue Dec 17 16:27:34 EST 2002


Michael Hudson <mwh at python.net> writes:

> jepler at unpythonic.net writes:
> 
> > I'd rather just write 'with lock: suite'.
> 
> Right.  Here's a proposal:
> 
> with <exp>:
>   <suite>
> 
> is equivalent to
> 
> _x = <exp>
> _x.__enter__()
> try:
>   <suite>
> finally:
>   _x.__exit__()

See also this thread on python-dev:
http://mail.python.org/pipermail/python-dev/2002-March/021369.html

I posted a very similar proposal there that also tried to allow for
loops:
http://mail.python.org/pipermail/python-dev/2002-March/021444.html

Barry Warsaw seemed to like approach too :)

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
MapIt!                                           http://www.mapit.de/



More information about the Python-list mailing list