PEP 285: Adding a bool type
Guido van Rossum
guido at python.org
Sat Mar 30 13:10:28 EST 2002
[me]
> > Tim must be missing something. The obvious way to turn a bool b into
> > an int is int(b). Having to import the obscure 'operator' module for
> > this purpose is backwards. (IMO there's almost *never* a reason to
> > import that module anyway.)
[Ralph]
> I thought Tim was trying to map a range of integer values onto just 0
> and 1 as ints, not False and True, where as you're suggesting he just
> wants to get an int from a boolean. I think he has an expression like
> day_of_month, e.g. 30, and wants a 0 or 1 from it.
I should've said int(bool(x)) for any expression x. When I wrote int(b) I
meant b to be a value that was already a bool.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-list
mailing list