- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
Issue41584
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2020-08-18 17:56 by brett.cannon, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 22505 | merged | brett.cannon, 2020-10-03 00:17 | |
| PR 22568 | merged | miss-islington, 2020-10-05 16:42 | |
| PR 22569 | merged | miss-islington, 2020-10-05 16:42 | |
| Messages (8) | |||
|---|---|---|---|
| msg375621 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2020-08-18 17:56 | |
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. |
|||
| msg375622 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2020-08-18 17:59 | |
Or to be more clear, the RHS subclass must provide a **different** implementation of the method than the LHS. |
|||
| msg375645 - (view) | Author: Vedran Čačić (veky) * | Date: 2020-08-19 12:22 | |
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__. |
|||
| msg375646 - (view) | Author: Vedran Čačić (veky) * | Date: 2020-08-19 12:26 | |
Sorry, of course I meant C()-A(). The point is that the class A _doesn't_ have to implement __rsub__. |
|||
| msg375668 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2020-08-19 18:37 | |
Right, there is a `lhs.__rsub__ is not rhs.__rsub__` check which needs to be clearly communicated in that note. |
|||
| msg378063 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2020-10-05 16:42 | |
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 |
|||
| msg378065 - (view) | Author: miss-islington (miss-islington) | Date: 2020-10-05 16:52 | |
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 |
|||
| msg378067 - (view) | Author: miss-islington (miss-islington) | Date: 2020-10-05 17:05 | |
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 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:34 | admin | set | github: 85750 |
| 2020-10-05 18:34:03 | brett.cannon | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2020-10-05 17:05:58 | miss-islington | set | messages: + msg378067 |
| 2020-10-05 16:52:10 | miss-islington | set | messages: + msg378065 |
| 2020-10-05 16:42:48 | miss-islington | set | pull_requests: + pull_request21565 |
| 2020-10-05 16:42:39 | brett.cannon | set | messages: + msg378063 |
| 2020-10-05 16:42:37 | miss-islington | set | nosy:
+ miss-islington pull_requests: + pull_request21564 stage: commit review -> patch review |
| 2020-10-03 00:17:58 | brett.cannon | set | stage: patch review -> commit review |
| 2020-10-03 00:17:07 | brett.cannon | set | keywords:
+ patch stage: needs patch -> patch review pull_requests: + pull_request21516 |
| 2020-08-19 18:37:37 | brett.cannon | set | messages: + msg375668 |
| 2020-08-19 12:26:32 | veky | set | messages: + msg375646 |
| 2020-08-19 12:22:22 | veky | set | nosy:
+ veky messages: + msg375645 |
| 2020-08-19 08:32:09 | Eric Wieser | set | nosy:
+ Eric Wieser |
| 2020-08-18 17:59:41 | brett.cannon | set | messages: + msg375622 |
| 2020-08-18 17:56:56 | brett.cannon | set | assignee: docs@python -> brett.cannon |
| 2020-08-18 17:56:34 | brett.cannon | create | |


