No Boolean type in "types"

Michael Hudson mwh21 at cam.ac.uk
Tue Jun 13 07:27:29 EDT 2000


"Thomas Mangin" <thomasm at legend.co.uk> writes:

> Hello,
> 
> Can someone explain me why the module "types" have no boolean type defined ?
> 
> true = (0==0)
> false = (not true)
> 
> BooleanType = type(0==0)
> 
> Thank you

Because type(0==0) == types.IntegerType.  Python has no boolean type;
the rules for determining whether a value is true or false are a
little involved, but generally do what you expect.

Cheers,
M.

-- 
81. In computing, turning the obvious into the useful is a living
    definition of the word "frustration".
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html



More information about the Python-list mailing list