[issue31550] Inconsistent error message for TypeError with subscripting

Raymond Hettinger report at bugs.python.org
Mon Mar 19 15:51:36 EDT 2018


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

I would like to leave this as-is.  Consistency between error message wording is one of our least important considerations.  The __getitem__ message is somewhat useful -- it helps learners know which magic method is being called and what they would need to add to a class to make it work.  This was the typical wording for old-style classes.  For example, calling len() on an old-style class without __len__ gave this message, "AttributeError: A instance has no attribute '__len__'".

In addition, we are getting very close to end-of-life for Python2.7.  Accordingly, any changes at this point should be limited to things that really matter.  It will be too easy to introduce a new problem that we won't have an opportunity to fix later.

I recommend closing this and shifting attention to things that matter.

----------
assignee:  -> rhettinger

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


More information about the Python-bugs-list mailing list