unexpected behavior: did i create a pointer?

Wildemar Wildenburger lasses_weil at klapptsowieso.net
Fri Sep 7 05:46:38 EDT 2007


gu wrote:
> hi to all!
> after two days debugging my code, i've come to the point that the 
> problem was caused by an unexpected behaviour of python. or by lack of 
> some information about the program, of course! i've stripped down the 
> code to reproduce the problem:
> 
> [snip FAQ]

Yes, basically you *created* a pointer. That's all that python has: 
pointers.

When saying
   >>> a = AnyOldObject()
   >>> b = a
then 'a' and 'b' are different /names/ for the /very same/ object (try 
"a is b", or "id(a)==id(b)").

This is really a FAQ (once a week or so?), but for the life of me I 
can't find the right words for a google query.
TO THE TROOP: What keywords would you attach to that question?

/W



More information about the Python-list mailing list