01.05.22 13:02, Spencer Brown пише:
It actually is documented as being supported here: https://docs.python.org/3.10/reference/datamodel.html#id2 <https://docs.python.org/3.10/reference/datamodel.html#id2>, and as mentioned there __iter__(), __reversed__() and __contains__() also have special support so they avoid trying to fallback to __getitem__ etc. Also some discussion at https://github.com/python/cpython/issues/70146 <https://github.com/python/cpython/issues/70146>. For most methods the conclusion back then makes sense, a specific exception message being raised would just potentially slow the interpreter.
Thank you Spencer. It answers my questions. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/LNE2COY3OAV7EJOMPBFBHSVPBTYM4KUQ/ Code of Conduct: http://python.org/psf/codeofconduct/