explain this

gods1child alankarmisra at hotmail.com
Tue Jul 3 15:36:49 EDT 2001


In the code below, why can i add elements to locals but not delete them?

>>> def function(argument):
... 	print locals()
... 	modify(locals())
... 	print locals()
... 	
>>> def modify(locals):
... 	del locals['argument']
... 	locals['new_argument'] = 'new_value'
... 	
>>> function(10)
{'argument': 10}
{'argument': 10, 'new_argument': 'new_value'}



More information about the Python-list mailing list