changing local namespace of a function

Nick Coghlan ncoghlan at iinet.net.au
Sat Feb 5 03:02:08 EST 2005


Bo Peng wrote:
> By the way, will 'with statement', like the one in pascal and many other 
> languages, be a good addition to python? For example,
> 
> with d do:
>   z = x + y
> 
> would be equivalent to d['z']=d['x']+d['y'] or d.z = d.x + d.y in some 
> other cases.
> 
> This would absolutely be the *best* solution to my problem.
> 
> Bo

Guido van Rossum has stated that he wants Python to eventually have a 'with' 
statement of the form:

   with d:
    .z = .x + .y

(The leading '.' being required to avoid ambiguity in name lookups)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list