xor operator?

Erik de Castro Lopo nospam at mega-nerd.com
Fri Jan 26 08:59:24 EST 2001


Def P wrote:
> 
> Hi,
> 
> I notice that there doesn't seem to be a boolean xor operator in Python. Does
> someone know the reasons behind this?

Hmm,

    Python 2.0 (#6, Jan 26 2001, 11:27:57) 
    [GCC 2.95.2 19991024 (release)] on linux2
    Type "copyright", "credits" or "license" for more information.
    >>> "%x" % (0x2^0xF)
    'd'
    >>> "%x" % (0xd^0xF)
    '2'

Seems to work for me :-).

Erik
-- 
+----------------------------------------------------------+
  Erik de Castro Lopo  nospam at mega-nerd.com (Yes its valid)
+----------------------------------------------------------+
Microsoft is not the answer.
Microsoft is the question. NO is the answer.



More information about the Python-list mailing list