Inheriting the @ sign from Ruby
Erik Max Francis
max at alcyone.com
Tue Dec 12 12:55:31 EST 2000
"Simon B." wrote:
> Isn't that Java? It *certainly* isn't Python - *everything* is by
> reference in python. Unless I'm *really* confused...
You're right, but for the immutable types, for all intents and purposes
passing by reference and passing by value are essentially the same
thing, because unless you're playing with the is operator, someone else
can't change the immutable object that you're pointing to, so it acts
very much like pass-by-value.
I presume (and my previous post was predicated on this) that the
original poster knew what he was talking about and was indeed just
analyzing Python's behavior from a high-level, C-like approach, talking
about pass-by-value for the immutables and pass-by-reference for
anything else for the sake of discussion.
I, too, wish that there were some more fundamental, builtin operator for
implementing shallow and deep copying that worked for all types; given
that everything in Python is passed by reference, I'm surprised that a
fundamental builtin (type-inspecific) operator for doing copies didn't
make it into the language very early on.
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ An undevout astronomer is mad.
\__/ Edward Young
Alcyone Systems / http://www.alcyone.com/
Alcyone Systems, San Jose, California.
More information about the Python-list