Sarcastic Zombie wrote:
> For example, in the code:
> 
> a = A(56)
> if a:
>    print "Hoo hah!"
> 
> how can I insure that the if will come back true and fire off the print
> if and only if self.id is defined? I want to do this in an overloaded,
> generic way, if possible; I know that I could test for a.id.

Define a method called __nonzero__ that returns True or False.

-- 
Roberto Bonvallet
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to