Socket connection

Steve Holden sholden at holdenweb.com
Mon Mar 10 14:14:52 CET 2003


"Dennis Lee Bieber" <wlfraed at ix.netcom.com> insisted that the penguins eat
the following fish:
> Steve Holden fed this fish to the penguins on Saturday 08 March 2003
> 11:43 am:
>
> > That may be so, but it needs to be better explained. After the
> > statements
> >
> > a = [2, 3, 4]
> > b = a
> >
> > where exactly are the Post-Its for "a" and "b" stuck? Does the Post-It
> > represent the name or the contents of the memory cell? etc., etc.
> >
>         I usually do go down the level lower... A and B a what are written
on
> the Post-It notes (one each), and said notes are stuck on whatever
> container holds the list object (memory cell, bucket on hanging from
> the ceiling...
>
OK. The problem with this as a teaching aid is that it implies the whole
object space has to be searched to find out where a particular name exists,
and doesn't really reflect the distinction between namespaces and values in
any kind of helpful way.

Your example allowed me to realise exactly what it was about the Post-It
analogy I didn't like, so thank you.

>         In a really silly simily (sp?)... in classical languages
>
[simile]

> a = 2br apartment
> b = a
> a = 3br apartment
>
> would say a is the mailing address of some specific 2br apartment, and
> that a new 2br apartment (an identical copy of the one at a) is built
> at address b; shortly thereafter, the 2br apartment at a is torn down
> and a 3br is built in its place
>
Indeed, Python and Icon are the only two languages I have used extensively
that support such reference-based assignment. I find it much more natural
natural than languages with typed values and copy-based assignment.

>         In Python, a is the name of the person living in some 2br
apartment
> (the address of said apartment is not fixed), and then b moves in to
> share the same apartment; finally a moves out of the 2br and into a 3br
> apartment that exists somewhere else.
>
Indeed. But the interpreter doesn't look at the data to find its name, (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 truth we
give the interpreter a name and it uses that as a reference to the data.

regards
--
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/
Register for PyCon now!            http://www.python.org/pycon/reg.html







More information about the Python-list mailing list