1 May
2022
1 May
'22
10:47 a.m.
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.