New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discourage operator.__dunder__ functions #74271
Comments
As discussed on the Python-Ideas mailing list, it is time to discourage the use of operator.__dunder__ functions. Not to remove them or deprecate them, just change the documentation to make it clear that the dunderless versions are preferred. Guido +1'ed this suggestion, and there were no objections: https://mail.python.org/pipermail/python-ideas/2017-April/045424.html |
My suggestion from the python-ideas thread:: replace the current "The function names are those used for special class methods; variants without leading and trailing __ are also provided for convenience." with ""Many function names are those used for special methods, minus the double underscores. For backward compatibility, many of these have a variant with the double underscores kept. We recommend using the dunderless form. Note that operator.__add__(x, y), for instance, being the same as x + y, is not the same as x.__add__(y)." Possibly add ", since the first two may result in calling y.__radd__(x)". Raymond assigned the |
Raymond assigned the PR to himself, so I added him here as nosy and assignee. |
@terry, I have updated the same, thanks! |
Raymond, may someone else merge this? I will add a blurb. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: