[docs] [issue30085] Discourage operator.__dunder__ functions

Terry J. Reedy report at bugs.python.org
Thu Apr 20 14:33:57 EDT 2017


Terry J. Reedy added the comment:

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

----------
assignee: docs at python -> rhettinger
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30085>
_______________________________________


More information about the docs mailing list