How best to check for existance of an attribute?

Roy Smith roy at panix.com
Tue Dec 25 17:04:44 EST 2001


Michael Hudson <mwh at python.net> wrote:
> By using hasattr?

Doh!  Thanks.  I probably knew about hasattr() once (I first learned python 
about 4 years ago), but forgot about it.

It's kind of wierd -- I just "discovered" the insert() and pop() list 
methods the other day, browsing the docs.  I'm sure I read about them when 
I was just learning the language, but they didn't seem to get bound to any 
brain cells.  I wonder what else I've forgotten about the language?



More information about the Python-list mailing list