On Wed, May 7, 2014 at 11:00 PM, Ethan Furman <et...@stoneleaf.us> wrote: > On 05/06/2014 11:18 PM, Marko Rauhamaa wrote: >> >> Actually, while Python variables are not first-class objects, one could >> see them as dictionary-key pairs. So you can even pass them by reference >> by passing the dictionary and the key. > > > Well, you could pass them that way, but not necessarily change them: > [ chomp demo code using locals() ]
That's because, while you can *think of* Python name bindings as being like dict key/value pairs, they aren't always that. Function locals, class locals, and other such namespaces aren't necessarily implemented with dicts. They're conceptually still a "dictionary" of sorts, but you can't actually pass anyone a dict and key and expect it to work. ChrisA -- https://mail.python.org/mailman/listinfo/python-list