[Tutor] __and_ and and_

David Ascher da@ski.org
Mon, 18 Oct 1999 10:29:02 -0700 (Pacific Daylight Time)


I should amend that -- one can define a special method which determines
the truth value, which is then used by the and, or and not mechanisms.

See the reference manual under __nonzero__:

__nonzero__ (self)

     Called to implement truth value testing; should return 0 or 1. When
     this method is not defined, __len__() is called, if it is defined
     (see below). If a class defines neither __len__() nor __nonzero__(),
     all its instances are considered true. 

--david