New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__getitem__ error message hard to understand #50010
Comments
Prompted by The current error message issued when trying to use the get item ([]) >>> class A(object): pass
...
>>> A()['a']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'A' object is unsubscriptable Problems observed:
Suggestion: AttributeError: class 'A' has no attribute '__getitem__'
The above exception was the direct cause of the following exception:
TypeError: 'A' object does not support the 'get item' operator Similar changes should be made to __setitem__ & __delitem__. |
As I said on the python-ideas discussion, which definitely did *not*
subscription ::= primary "[" expression_list "]"
|
I concur. I changed "unsubscriptable" to "not subscriptable" in r71696. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: