On Sun, Feb 7, 2010 at 5:51 PM, Alf P. Steinbach <al...@start.no> wrote:
> Incorrect; Python uses neither. See >> http://effbot.org/zone/call-by-object.htm for a excellent explanation >> >> of what Python does use. >> > > Hm. While most everything I've seen at effbot.org has been clear and to > the point, that particular article reads like a ton of obfuscation. > > Python passes pointers by value, just as e.g. Java does. > > There, it needed just 10 words or so. :-) Or perhaps some more words to > point out that in the Java language spec those reference values are called > pointers, but that this terminology isn't (apparently) used for Python, and > isn't even well known among Java programmers. But that's just one extra > little para. > One just has to be clear about exactly what it is that's passed by value. > > Not Python objects, but references (pointers) to them, the id(o) values. > Sigh. Why does this always come up? And then someone makes a statement like this, and now a /very/ long thread in which everyone argues semantics will begin and sooner or later, the presence of the GIL will cause a Python civil war, even though the GIL has nothing to do with anything related to this conversation. Mark my words! Python only passes by value if you use a non-standard definition of "value": and the moment you do that, a whole bunch of people will start making weird assumptions of Python's object and scoping semantics and all kinds of confusion will occur. Or holy wars on words shall come to pass. Python does not have pointers, it is not passing a pointer, it is passing an object. The moment you start talking about passing pointers, people start expecting things to work as if they -were- pointers. Python objects don't. Python has names, and objects. It passes objects. Those objects get a new name as a result. If the object is mutable, changes will be seen by the caller. If the object is not, changes won't (because you're re-binding a name, not changing an object). Any attempt to apply any other sort of words or labels besides "names" and "objects" to the situation is just going to confuse people and make them think Python-is-LanguageXor Python-works-like-LanguageY. Let the argument begin! Again. --S
-- http://mail.python.org/mailman/listinfo/python-list