Socket connection

Alex Martelli aleax at aleax.it
Fri Mar 14 09:12:37 EST 2003


Steve Holden wrote:
   ...
> (and indeed we have to regularly point out in c.l.py that objects don't,
> in fact "have" names, they are simply "bound to" one or more names). In

Just to pick a nit (but actually reinforcing your point), I'd rather
say it's NAMES (and that, only in a very wide sense of "name") that
are bound to objects, rather than vice-versa.  E.g.:

somename = SomeClass(23)
somelist.append(somename)
del somename

the object instantiated by the call SomeClass(23) is blissfully
unaware of all this binding and rebinding of (wide-sense) "names"
to it (in C-Python it gets addref/decref calls to let it COUNT
the number of references extant -- in Jython, which is another
perfectly valid implementation of the Python language, it doesn't
get even that).  And considering that "the N-th item of list
somelist for a value of N that I don't even know right now and
can anyway change when somelist is changed later" is ``a name''
is pushing the sense of "name" a bit wider than I'm really
comfortable with.

I think that it might be more helpful to say: at any time one
or more REFERENCES can be bound to an object (if ZERO are, then
the object will go away -- at once in CPython, "eventually" in
Jython); names are references, but there are also other kinds
of references (such as being an item in a list) that are not
really names.


Alex





More information about the Python-list mailing list