Message224029
| Author |
Claudiu.Popa |
| Recipients |
Claudiu.Popa |
| Date |
2014年07月26日.08:52:10 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1406364730.89.0.733726269195.issue22077@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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
The attached patch improves these error messages. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年07月26日 08:52:10 | Claudiu.Popa | set | recipients:
+ Claudiu.Popa |
| 2014年07月26日 08:52:10 | Claudiu.Popa | set | messageid: <1406364730.89.0.733726269195.issue22077@psf.upfronthosting.co.za> |
| 2014年07月26日 08:52:10 | Claudiu.Popa | link | issue22077 messages |
| 2014年07月26日 08:52:10 | Claudiu.Popa | create |
|