hashcollision wrote:
> Currently,
> True or False
> works as expected, but
> True xor False
> is invalid. I don't see a reason why and, or, not are valid python 
> keywords but xor is not. Can this be added in python 3.0 for completeness?

XOR can't be shortcircuited, so it doesn't gain from having a special 
keyword the way AND and OR do. If you really want a logical XOR, 
'bool(var1) ^ bool(var2)' will do the trick, or you can just write your 
own xor function. In my experience, logical XOR is pretty rare anyway 
(while bitwise XOR is common).

> Also,
> True & False, True | False, True ^ Fals, True != False
> works but
> !True, !False
> dosn't. Again, IMHO this is inconsistent and should be fixed.

Why? As Oleg already stated, if you want a bitwise negation, use '~' 
(giving -2 and -1 respectively), if you want logical negation, use 'not' 
(giving False and True respectively).

Cheers,
Nick.

-- 
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to