On Sat, 07 Jan 2006 11:20:25 +0000, Bryan Olson wrote: > Wrong. C does not have references, and the Python use is consistent > with the rest of computer science. You seem to have read in things > that it does not mean. Fix *your* thinking.
Bryan, I'll admit that I'm no C/C++ programmer, and I frequently assume that if X is true for C++ it is also true for C, and vice versa. I appreciate being corrected when I make a mistake. However, in this case, I think you are confused by the term references. Of course pure C does not have the C++ data structure known as "references", but that is hardly the only meaning of the word. "Reference" is a generic term for something which refers to something else, not just in plain English but also in computer science. Pointers are references. Indexes into a table are references. URLs are references. File names and file handles are references, as are keys from databases, and even raw memory addresses. http://en.wikipedia.org/wiki/Reference_(computer_science) I'll admit that my position on this question has changed. I no longer say that "everything in Python is a reference" is *false*, not in the weak, generic sense. How can it be? In the generic sense, Python names are references. (Under the hood, names may even be implemented as C++ references for all I know.) I will still argue that the term reference is harmful, not because it is technically incorrect, but because it activates incorrect mental models of Python's high-level behaviour in too many people. >> That's why people come to Python with a >> frame that tells that what call by reference implies ("I can do this...") >> and then they discover that they often *can't* do that. > > I'm sorry if you got confused, but please don't project it on > the rest of the discipline. Perhaps you should check out the beginning of the thread before making any additional comments. It wasn't me who was confused and asked "Hey what's going on? I was told everything in Python is a reference, but when I do this it doesn't work." I'm not projecting anything on anyone. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list