Does python hate cathy?

Tim Chase python.list at tim.thechases.com
Mon Mar 24 02:05:58 CET 2008


> When I run this script, I got the following exception:
> Exception exceptions.AttributeError: "'NoneType' object has no
> attribute 'population'" in <bound method Person.__del__ of
> <__main__.Person instance at 0xb7d8ac6c>> ignored
> 
> To to newcomer like me, this message doesn't make much sense. What
> seems weird to me is that, if I change the variable cathy to something
> else, like cath, or even cat, then the script will finish gracefully.
> Why "cathy" is not liked?!!
> 
> My python is of version 2.5.1, on Ubuntu.

When I first read this, I thought you were crazy.  I ran the 
code, and you're not.  I tried under versions 2.3, 2.4, and 2.5 
on my Debian box, and got the same results.  Neither "cathy" nor 
"ca" works,  but "c", "cat", "cath", "cath_y" and "cathy_" all 
work just fine.

Even more infuriating is that if I try and use pdb to debug, 
Swaroop drops into pdb, but Abdul and Cathy both error out.

That's just plain nuts.  Something odd is happening with __del__ 
calls.

-tkc






More information about the Python-list mailing list