anything like C++ references?
mcherm at mcherm.com
Mon Jul 14 15:47:44 CEST 2003
In the (lengthy) thread "anything like C++ references?" there developed
(yet another) huge discussion of how assignment and parameter passing
works in Python.
In response, Ian Bicking wrote:
> Python is not novel in the way it deals with variables. Scheme and
> Smalltalk, for instance, act exactly the same, as do many other
> dynamically typed languages [...].
> This isn't a funny little feature, this is the way all strong,
> dynamically typed languages work.
> The problem you have is you are still thinking of variables as slots,
> which is not correct. Variables in Python are bindings. Assignment
> never copies anything, or creates anything except for changing the
> variable to point to a different address location. *Every* Python
> assignment (a=b) is like the C assignment (a=&b).
I have nothing whatsoever to add to this... it is just so clearly and
simply stated that I felt it was worth repeating. Of course, lots of
other people said the same thing in other ways, but I felt that Ian's
phrasing is particularly useful in explaining things to programmers
coming from a C-style background, even if it doesn't seem to reach
-- Michael Chermside
More information about the Python-list