[issue31042] Inconsistency in documentation of operator.index

Joseph Fox-Rabinovitz report at bugs.python.org
Tue Nov 30 23:00:06 EST 2021


Joseph Fox-Rabinovitz <jfoxrabinovitz at gmail.com> added the comment:

I closed the issue (it's already been rejected), primarily based on

> a.__index__ = <whatever> is an unauthorized use of a *reserved* word and the effect of such usage is not and need not be documented.  

> The entry for __*__ does include "*Any* use of __*__ names, in any context, that does not follow explicitly documented use, is subject to breakage without warning."  To me, that says that the effect of the reserved-word assignment is undefined.  It could be made to raise an exception.

It's like filing a bug report for UB in C.

----------
stage: needs patch -> resolved
status: pending -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31042>
_______________________________________


More information about the Python-bugs-list mailing list