Bruno Desthuilliers <[EMAIL PROTECTED]> writes: >> It seems to me that in recent times more Python beginners come from >> a Java background than from a C one. > > Java does have "container" variables for primitive types, and even > for "references", Java's variables are more than names - they do > hold type informations too. Now I don't pretend to know how this is > really implemented, but AFAICT, and at least from a cognitive POV, > Java's variables model looks very close to the C/C++ model.
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. If Java's model were close to C/C++, that would not be possible without explicit pointers/references since an object would be "contained" by the variable. Variables holding primitive types don't really influence the variable/object relationship, since the values they hold are by nature immutable and without identity. -- http://mail.python.org/mailman/listinfo/python-list