Bryan Olson wrote: > > Words are important -- not only for what they mean, but for what the > > connotations they carry. For people who come to Python from C-like > > languages, the word "reference" means something that is just not true in > > the context of Python's behaviour. > > Wrong. C does not have references
Unless they've changed it since the drafts, the ANSI C specification uses the word "reference" to describe how pointers work: A pointer type describes an object whose value provides a reference to an entity of the referenced type. A pointer type derived from the referenced type T is sometimes called ``pointer to T''. The construction of a pointer type from a referenced type is called ``pointer type derivation''. so unless you're using some odd dialect of C that doesn't support pointers, your C implementation sure has references. > and the Python use is consistent with the rest of computer science. The problem isn't the word "reference" in itself, the problem is when people are implying that "since Python passes object references to functions, it's using call by reference". In ordinary CS, "call by reference" generally means that the function is handed a reference to the *variable* holding the *value*. You can do this explicitly in C (by passing in &arg instead of arg), and you can do this in C++, but there's no way to do this in Python -- Python variables hold objects, not values. Saying that Python uses "call by value" is probably more correct (where the values are references), but that's even more confusing. (see endless earlier threads for more on this). > That would be a terrible thing to do. Just learn to use the > meaning accepted in the discipline, and used in the Python doc. afaik, the Python Language Reference never defines the word "reference". It carefully defines words like "object" and "value", though, and terms like "call by object" or "call by object reference" are perfectly understandable if you use the words as they are defined in the language reference. </F> -- http://mail.python.org/mailman/listinfo/python-list