Re: Where is ^ (symmetric_difference) documented in help()?

2017-12-22 Thread Steve D'Aprano
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


Re: Where is ^ (symmetric_difference) documented in help()?

2017-12-22 Thread Steve D'Aprano
On Sat, 23 Dec 2017 02:35 pm, Peng Yu wrote:

> Hi, I see the following two lines are the same. But I'd like to find
> where ^ is documented via the help() function (I am not looking for
> the document in html)? Does anybody know? Thanks.
> 
> s.symmetric_difference(t)
> s ^ t


You can call:

help("^")

(notice you need to quote the operator) but it only talks about the bitwise
operators.


I've just raised bug report for this: 

https://bugs.python.org/issue32412




-- 
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


Re: Where is ^ (symmetric_difference) documented in help()?

2017-12-22 Thread Peng Yu
Where is it documented that __xor__ and ^ is the same as
symmetric_difference? Thanks.

BTW, I am using to Python 2, your help message is different from mine.
Do you use Python 3?

On Fri, Dec 22, 2017 at 9:41 PM, Dan Sommers  wrote:
> On Fri, 22 Dec 2017 21:35:53 -0600, Peng Yu wrote:
>
>> Hi, I see the following two lines are the same. But I'd like to find
>> where ^ is documented via the help() function (I am not looking for
>> the document in html)? Does anybody know? Thanks.
>>
>> s.symmetric_difference(t)
>> s ^ t
>
> It's sort of documented in help(set):
>
>  |  __xor__(self, value, /)
>  |  Return self^value.
>
> HTH,
> Dan
>
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Regards,
Peng
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Where is ^ (symmetric_difference) documented in help()?

2017-12-22 Thread Dan Sommers
On Fri, 22 Dec 2017 21:35:53 -0600, Peng Yu wrote:

> Hi, I see the following two lines are the same. But I'd like to find
> where ^ is documented via the help() function (I am not looking for
> the document in html)? Does anybody know? Thanks.
> 
> s.symmetric_difference(t)
> s ^ t

It's sort of documented in help(set):

 |  __xor__(self, value, /)
 |  Return self^value.

HTH,
Dan

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


Where is ^ (symmetric_difference) documented in help()?

2017-12-22 Thread Peng Yu
Hi, I see the following two lines are the same. But I'd like to find
where ^ is documented via the help() function (I am not looking for
the document in html)? Does anybody know? Thanks.

s.symmetric_difference(t)
s ^ t

-- 
Regards,
Peng
-- 
https://mail.python.org/mailman/listinfo/python-list