"has" Operator
Paul Sidorsky
paulsid at home.com
Sat Jul 7 18:10:44 EDT 2001
Roman Suzi wrote:
> if hasattr(myobject, "someattribute"):
> foo()
> else:
> bar()
> is clean enough, IMHO...
Oops, I didn't know about hasattr(). Yes, that certainly does the
trick. Though I have to say the syntax is a little odd (what with the
quotes), but it's certainly sufficient. Thanks! Sorry to bother
everyone.
--
======================================================================
Paul Sidorsky Calgary, Canada
paulsid at home.com http://members.home.net/paulsid/
More information about the Python-list
mailing list