changing local namespace of a function

Bo Peng bpeng at rice.edu
Sat Feb 5 01:05:09 EST 2005


> Maybe it is just my laziness. It is almost intolerable for me to write 
> lines and lines of code like
> 
>   d['z'] = func(d['x']+d['y']+d['whatever']['as']+d[a][0] )
> 

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



More information about the Python-list mailing list