A class question

Hrvoje Niksic hniksic at xemacs.org
Tue Oct 30 10:04:54 CET 2007

Bruno Desthuilliers <bruno.42.desthuilliers at wtf.websiteburo.oops.com>

>> While Java's variable declarations bear a superficial (syntactical)
>> similarity to C, their semantics is in fact equivalent to the
>> object-reference semantics we know in Python.   They implicitly refer
>> to objects allocated on the heap and, just like in Python, the same
>> object can be referenced by multiple variables. 
> You're talking about reference types here - not primitive types. And
> even then, from what I remember (not having done any Java these last
> 4 years at least), Java's reference types are much closer to C++
> references than to Python.

Feel free to look it up; I believe you will find the semantics of
assignment, parameter-passing, etc., exactly the same as in Python.

>> Variables holding primitive types don't really influence the
>> variable/object relationship, since the values they hold are by
>> nature immutable and without identity.
> Python's immutable types instances does have an identity,

Just to clarify, here I was talking about Java's primitive-typed
variables, not drawing a parallel between Java and Python in that

More information about the Python-list mailing list