By value or by reference?
Alex Martelli
aleaxit at yahoo.com
Wed Oct 20 18:00:13 EDT 2004
More information about the Python-list mailing list
Wed Oct 20 18:00:13 EDT 2004
- Previous message (by thread): By value or by reference?
- Next message (by thread): By value or by reference?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Gustavo Niemeyer <niemeyer at conectiva.com> wrote: ... > It really depends on what you claim to be passed by value. In Python, > objects are passed by reference, but references are passed by value. So > one may say that z is being passed by value, since what is passed is a > copy of the reference. With that in mind, one may correctly say that > Python always do pass-by-value, and correctly say that it always do > pass-by-reference. That's my point, even though it's argued the other way 'round, that neither is correct, given the usual connotations of these terms. > Here is an article presenting the issue in more detail (much more :-): > > http://www-106.ibm.com/developerworks/java/library/j-passbyval/ > > > The terminology problem may be due to the fact that, in python, the > > value of a name is a reference to an object. So, you always pass the > > value (no implicity copying), and that value is always a reference. > [...] > > That's it. Right. And in common use, pass-by-value and -by-reference are thought to imply something else. I wonder how Java deals with it, since (except for some primitive types like int) it's just the same mechanism as Python's; being widely used and academically acceptable it must have found a satisfactory way to explain this, one would hope. Alex
- Previous message (by thread): By value or by reference?
- Next message (by thread): By value or by reference?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list