Bug with lists of pairs of lists and append()

Gabriel Zachmann zachREMOVE at MEin.tu-clausthal.de
Mon Oct 1 11:37:10 CEST 2007

> If you're familiar with C or C++, think of s as holding a pointer to x
> which in turn holds a pointer to l and r, so when you change l or r, x
> (and s indirectly) is still pointing to the same lists which by the

AH - thanks a million -- that makes it crystal clear!
[Python's apparent simplicity keeps making me forget that everything is 
a pointer ...]

> BTW:  It's not really "misbehaving."  It's doing exactly what you're
> telling it to do ;-)

i had a feeling ... ;-)


Life is so constructed that the event does not, cannot,
will not match the expectation.             (Charlotte Bronte)
  zach in.tu-clausthal.de      __@/'    www.gabrielzachmann.org

More information about the Python-list mailing list