You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
assignee='https://github.com/terryjreedy'closed_at=<Date2014-08-02.05:32:25.890>created_at=<Date2014-07-26.08:52:10.860>labels= ['type-feature']
title='Improve the error message for various sequences'updated_at=<Date2014-08-02.05:32:25.889>user='https://github.com/PCManticore'
For a couple of sequences (bytes, list, tuple, bytearray), the error when using an invalid sequence index is misleading, because it says that only integers are allowed, while slices are allowed too.
>>> a = []
>>> a['python']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: list indices must be integers, not str
>>>
For instance, here's how range does it:
>>> range(1)['a']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: range indices must be integers or slices, not str
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: