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:
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."
""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)".
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
The text was updated successfully, but these errors were encountered: