[2013-01-05] Python boolean value of an object
This is helpfull if want to use Mock-objects in Case an Object is not available, but still want to know if a real object is available or not. I found the solution at stackoverflow.
def __init__(self, bar):
self.bar = bar
return self.bar % 2 == 0