Variables vs. names
Aahz
aahz at pythoncraft.com
Mon Oct 7 09:33:41 EDT 2002
In article <j4fzvi950k.fsf at informatik.hu-berlin.de>,
Martin v. =?iso-8859-1?q?L=F6wis?= <loewis at informatik.hu-berlin.de> wrote:
>aahz at pythoncraft.com (Aahz) writes:
>>
>> Python names don't have values. Names are always references to objects.
>> I don't know Java well enough to have any clue how it handles references,
>> but I know Java doesn't have pointers.
>
>Python and Java are really the same in this respect. In Java,
>variables are (normally) references to objects. The only exception are
>primitive types, which are stored and passed by value. Since they are
>immutable, this difference is negligible. Like Java, Python does not
>have pointers, either.
Interesting. Does Java permit subclassing from primitive types? What's
the Java equivalent of this code:
import m
def f(a):
return a.x
def g(foo, bar):
return foo(bar)
print g(f, m)
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
Project Vote Smart: http://www.vote-smart.org/
More information about the Python-list
mailing list