Apology Re: Is 'everything' a refrence or isn't it?
kylotan at gmail.com
Tue Jan 10 13:08:14 CET 2006
Alex Martelli wrote:
> Ben Sizer <kylotan at gmail.com> wrote:
> > assignment semantics that differ from languages such as C++ and Java,
> > not the calling mechanism. In C++, assignment means copying a value. In
> > Python, assignment means reassigning a reference.
> And in Java, it means just the same as in Python (with some unfortunate
> exceptions, in Java, for elementary types such as int -- but for all
> normal types, the meaning of assignment and parameter passing is just
> the same in Java as in Python).
> Considering that Java may have become the language most used for first
> courses in programming, it's unfortunate to propagate disinformation
> about its assignment semantics differing from Python's -- it will
> confuse people who know Java, and there are many of those.
Yes, my mistake - I forgot that Java reseats object references rather
than copying object values. (I'm a C++ person at heart.)
Personally I think this is a reason why Java is a poor language to
teach beginners, as it's stuck between low level semantics from C and
high level semantics like those of Python. It doesn't provide a very
consistent view, meaning you're bound to get confused no matter what
second language you start to learn.
More information about the Python-list