bool behavior in Python 3000?

aaron.watters at gmail.com aaron.watters at gmail.com
Wed Jul 11 09:52:48 EDT 2007


On Jul 11, 3:37 am, Rob Wolfe <r... at smsnet.pl> wrote:
>
> But `bools` are usefull in some contexts. Consider this:
>
> >>> 1 == 1
> True
> >>> cmp(1, 1)
> 0
> >>> 1 == 2
> False
> >>> cmp(1, 2)
>
> -1
>
> At first look you can see that `cmp` does not return boolean value
> what not for all newbies is so obvious.

Excellent point!  And as long as we have them I
agree with Alan that the boolean data type should
implement real boolean algebra with respect to +, *, and ~,
for example supporting operator precedence appropriately
(versus using and, or, not) and also correctly
implementing DeMorgan's laws and other property's of
boolean algebra

   ~(a*b) == ~a + ~b

etcetera.

1+True is bad practice and should be an error.

Anything else is false advertising
(and the java community has the patent on that
methodology :c) ).

  -- Aaron Watters

===
Why does a giraffe have such a long neck?
Because its head is so far from its body!




More information about the Python-list mailing list