PyDocs

Nav

Python Runtime Services

object.__bool__

builtins

method of object
  • object.__bool__(self)
Called to implement truth value testing and the built-in operation bool(); should return False or True. When this method is not defined, __len__() is called, if it is defined, and the object is considered true if its result is nonzero. If a class defines neither __len__() nor __bool__() (which is true of the object class itself), all its instances are considered true.
0 Examples
No examples for builtins/object.__bool__.
See Also
No see-alsos for builtins/object.__bool__
0 Notes
No notes for object.__bool__