bool behavior in Python 3000?
Bruno Desthuilliers
bruno.42.desthuilliers at wtf.websiteburo.oops.com
Fri Jul 13 06:35:58 EDT 2007
Miles a écrit :
> On Jul 12, 8:37 pm, Alan Isaac <ais... at american.edu> wrote:
>> I do not like that bool(False-True) is True.
>
> I've never seen the "A-B" used to represent "A and not B", nor have I
> seen any other operator used for that purpose in boolean algebra,
> though my experience is limited. Where have you seen it used?
I've personnaly seen the usual arithmatic operators used for boolean
algebra in quite a lot of papers covering the topic - but I've always
had to translate them to more common boolean ops to understand these
papers.
> What's wrong with 'and', 'or', and 'not'? I think that redefining *,
> +, and - to return booleans would only encourage programmers to use
> them as shortcuts for standard boolean operations--I'd hate to see
> code like this:
>>>> if user.registered * (user.age > 13) - user.banned: ...
>
OMG ! Lord have mercy ! St Guido, save us !
> I don't mind that arithmatic operations are _possible_ with bools, but
> I would strongly prefer to see the boolean keywords used for
> operations on booleans.
+10
More information about the Python-list
mailing list