[Tutor] bitwise ops in Idle

Vicki Stanfield vicki at thepenguin.org
Thu Nov 20 13:13:26 EST 2003


I am trying to get the value of a reiterative XOR operation and thought
I'd use Idle to figure it out. I thought the module which allows for
bitwise ops was the operator module, so I first did:

import operator

Next, intending to XOR the values of hex 5E and hex 9, I tried this:

or_('\x5E','\x09')

It didn't like this, returning:

Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
NameError: name 'or_' is not defined

What am I doing wrong? My intention is to loop through XORing a given
value for the required number of iterations.

Thanks,
--vicki





More information about the Tutor mailing list