Inheriting the @ sign from Ruby
nas at arctrix.com
Tue Dec 12 05:26:52 EST 2000
On Tue, Dec 12, 2000 at 08:56:51AM -0800, Erik Max Francis wrote:
> Roy Katz wrote:
> > (I've been programming in Python for three years now
> > and I understand only that passing an int or float is call-by-value,
> > otherwise it is call-by-reference. At the risk of naivete, I would
> > like a simple & referencing operator so that I can explicitly,
> > finally, have control over this.)
> This is actually something I wish had been done explicitly as well; this
> is one of the only areas of Python that I found truly irregular and
> strange. It would have been nice to either have pass-by-value be the
> default and have an explicit operator for referencing, or vice versa
> (doesn't matter to me which one, as long as it's consistent;
> pass-by-value as the default makes a little more sense). Alas, it is a
> little too late for that.
You are both confused. Roy, I find it hard to believe that you
could program in Python for three years and still have such a
warped mental model of it works. Erik, there is no irregularity.
There is no "pass by value". Variables do no contain values they
reference them. Always.
Furthermore, "pass by value" would be a horrible default.
Imagine passing a multiple megabyte string or list around. If it
is passed by value then a copy must be made for every function
More information about the Python-list