Socket connection

Michael Hudson mwh at python.net
Fri Mar 7 10:18:08 EST 2003


sik0fewl <xxdigitalhellxx at hotmail.com> writes:

> Hey,
> 
> I fixed the problem, thanks for your input, guys. It problem ended up
> having to do with assigning a list to another list. (That's what I get
> for not posting all my code)
> 
> I had no idea that x = y just references y to x (when x & y are lists).

That x and y are lists has NOTHING to do with it!  This is an
important point: assignment is a binding operation in Python.

> ie,
>  >>> x = []
>  >>> y = x
>  >>> id(x)
> 17763920
>  >>> id(y)
> 17763920
> 
> Could somebody point me to the documentation on this?

You could try these pages:

    http://starship.python.net/crew/mwh/hacks/objectthink.html
    http://effbot.org/guides/python-objects.htm 
    http://www.python.org/doc/2.3a2/ref/assignment.html#l2h-314

(or indeed

http://www.lispworks.com/reference/HyperSpec/Body/26_glo_b.htm#binding
http://www.lispworks.com/reference/HyperSpec/Body/26_glo_a.htm#assign

but that would be a little adventurous)

"It's just the way Python is" -- after a while, it'll become second
nature.

Cheers,
M.

-- 
  we're already scrubbing the face of intuition with steel wool,
  setting it on fire, then putting it out with an axe <wink>.
                      -- Tim Peters, on comparing recursive structures




More information about the Python-list mailing list