Paul Rubin wrote:
> Steve Holden <[EMAIL PROTECTED]> writes:
> 
>>The really interesting question your post raises, though, is "Why do
>>you feel it's necessary to test to see whether a variable is a
>>Boolean?".
> 
> 
> What's the point of having Booleans, if you can't tell them from integers?

Booleans are specifically defined as a subtype of int at the C level. 
One might also ask "what's the point of having floats if you can't tell 
them from integers":

 >>> 0.0 in [1,2,0,4]
True
 >>>

It just so happens that __contains__() uses an equality test (which it 
should) and equality tests perform certain coercions (which they 
arguably shouldn't, but in that case I wouldn't be the one doing the 
arguing).

"""
     The only thing that changes is the preferred values to represent
     truth values when returned or assigned explicitly.  Previously,
     these preferred truth values were 0 and 1; the PEP changes the
     preferred values to False and True, and changes built-in
     operations to return these preferred values.
"""

PEP 285.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to