[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-10-05 Thread Brett Cannon


Change by Brett Cannon :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-10-05 Thread miss-islington


miss-islington  added the comment:


New changeset 4aad1e5770fab72908f922a7876075d3d5a7c0d0 by Miss Skeleton (bot) 
in branch '3.9':
bpo-41584: clarify when the reflected method of a binary arithemtic operator is 
called (GH-22505)
https://github.com/python/cpython/commit/4aad1e5770fab72908f922a7876075d3d5a7c0d0


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-10-05 Thread miss-islington


miss-islington  added the comment:


New changeset 31ceccb2c77854893f3a754aca04bedd74bedb10 by Miss Skeleton (bot) 
in branch '3.8':
bpo-41584: clarify when the reflected method of a binary arithemtic operator is 
called (GH-22505)
https://github.com/python/cpython/commit/31ceccb2c77854893f3a754aca04bedd74bedb10


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-10-05 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21565
pull_request: https://github.com/python/cpython/pull/22569

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-10-05 Thread Brett Cannon


Brett Cannon  added the comment:


New changeset d02d824e05e2cb86f4df381be18832e76e2c475f by Brett Cannon in 
branch 'master':
bpo-41584: clarify when the reflected method of a binary arithemtic operator is 
called (#22505)
https://github.com/python/cpython/commit/d02d824e05e2cb86f4df381be18832e76e2c475f


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-10-05 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +21564
stage: commit review -> patch review
pull_request: https://github.com/python/cpython/pull/22568

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-10-02 Thread Brett Cannon


Change by Brett Cannon :


--
stage: patch review -> commit review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-10-02 Thread Brett Cannon


Change by Brett Cannon :


--
keywords: +patch
pull_requests: +21516
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/22505

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-08-19 Thread Brett Cannon


Brett Cannon  added the comment:

Right, there is a `lhs.__rsub__ is not rhs.__rsub__` check which needs to be 
clearly communicated in that note.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-08-19 Thread Vedran Čačić

Vedran Čačić  added the comment:

Sorry, of course I meant C()-A(). The point is that the class A _doesn't_ have 
to implement __rsub__.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-08-19 Thread Vedran Čačić

Vedran Čačić  added the comment:

Yes, there is a corner case here. If A derives from B and B derives from C, A 
doesn't implement __rsub__ and B does, A()-C() will call B's __rsub__.

--
nosy: +veky

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-08-19 Thread Eric Wieser


Change by Eric Wieser :


--
nosy: +Eric Wieser

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-08-18 Thread Brett Cannon


Brett Cannon  added the comment:

Or to be more clear, the RHS subclass must provide a **different** 
implementation of the method than the LHS.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-08-18 Thread Brett Cannon


Change by Brett Cannon :


--
assignee: docs@python -> brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-08-18 Thread Brett Cannon


New submission from Brett Cannon :

https://docs.python.org/3/reference/datamodel.html#object.__ror__ has a note 
saying:

"If the right operand's type is a subclass of the left operand's type and that 
subclass provides the reflected method for the operation, this method will be 
called before the left operand's non-reflected method." The slightly unclear 
part (at least to me) is the "provides the reflected method."

What this actually means according to https://bugs.python.org/issue30140 is 
that the subclass **implements** the `__r*__` method, not just that the method 
is reachable on the subclass via getattr(). That wasn't clear to me when I 
initially read this.

--
assignee: docs@python
components: Documentation
messages: 375621
nosy: brett.cannon, docs@python
priority: normal
severity: normal
stage: needs patch
status: open
title: Clarify documentation for binary arithmetic operation subclass __r*__ 
precedence
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com