Why can't I xor strings?

Grant Edwards grante at visi.com
Sun Oct 10 17:49:35 EDT 2004


On 2004-10-10, Jeremy Bowers <jerf at jerf.org> wrote:

> But I do think that a bitwise operator should silently
> transform to a logical operator for strings is not obvious.
>
> What is 388488839405842L ^ "hello"?

No, I wouldn't want that either.  What I was talking about was
the possibility of an "xor" logical operator that would behave
in a manner similar to the other logical operators in that it
coerces it's parameters to boolean values.

-- 
Grant Edwards                   grante             Yow!  I am covered with
                                  at               pure vegetable oil and I am
                               visi.com            writing a best seller!



More information about the Python-list mailing list