Variables vs. names

Joseph A. Knapka jknapka at earthlink.net
Wed Sep 11 19:45:23 CEST 2002


Hi folks,

I've been using Python for some time now, and I am
completely cognizant of and comfortable with its
semantics. However, I'm curious about something:

I understand that a Python "variable" is really
just a dictionary key; fine. In other languages,
instead of "naming" a dictionary entry, a
variable might directly "name" a chunk of
storage. So other than the layer of indirection
introduced by the dictionary mapping, what is
the practical significance of "names bound to values"
vs "variables with values"? Are there languages that
achieve Python's semantics using "real"
variables? Java's semantics seem pretty much
identical to Python's in this respect, yet
nobody in the Java community will object if
you call a thing-with-a-name-and-a-value a
"variable".

(And does an instance of a class with __slots__
have "names bound to values" for its members, or does
it have actual "variables"?)

Just curious,

-- Joe
  "I'd rather chew my leg off than maintain Java code, which
   sucks, 'cause I have a lot of Java code to maintain and
   the leg surgery is starting to get expensive." - Me



More information about the Python-list mailing list