On Sat, 23 Dec 2017 03:50 pm, Peng Yu wrote:

> Where is it documented that __xor__ and ^ is the same as
> symmetric_difference? Thanks.

You read 

https://docs.python.org/2/library/stdtypes.html#set

to learn that ^ is the same as symmetric difference, and then read:

https://docs.python.org/2/reference/datamodel.html#emulating-numeric-types

to learn that you must override __xor__ to override the ^ operator.

It isn't really clear from the documentation that the set operator ^ is
implemented by __xor__ (and also __rxor__). Perhaps you can suggest a
documentation patch?



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to