Strange object identity problem

Ulrich Eckhardt ulrich.eckhardt at dominolaser.com
Mon Nov 12 14:26:19 CET 2012


Am 12.11.2012 14:12, schrieb F.R.:
> Once in a while I write simple routine stuff and spend the next few hours
> trying to understand why it doesn't behave as I expect. Here is an example
> holding me up:
[...snip incomplete code...]
> Trying something similar with a simpler class works as expected:
[...snip example code...]

Okay, that's almost a classic. You ask about code that fails, while 
providing code that works as example. Crystal balls are rare nowadays, 
so this is really hard to answer!

In any case, here's what you could do:
1. use a debugger (import pdb...)
2. some more info could be retrieved by outputting the actual type along 
with the ID of the objects in question (see type() function)
3. reduce the non-working code until you have a minimal example that you 
can post here

I'd bet that at latest while trying approach 3 above, you will find the 
error yourself.

Good luck!

Uli



More information about the Python-list mailing list