How best to check for existance of an attribute?

Michael Amrhein michael.amrhein at t-online.de
Wed Dec 26 09:03:29 EST 2001


"Roy Smith" <roy at panix.com> schrieb im Newsbeitrag
news:roy-A5844A.17044425122001 at news1.panix.com...
> 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?

Perhaps Mark Lutz' "Python Pocket Reference" (O'Reilly, ISBN 0-596-00189-4,
$11.95) would be a good investment for you.
:-) Michael





More information about the Python-list mailing list