[docs] [issue7951] Should str.format allow negative indexes when used for __getitem__ access?

Marco Buttu report at bugs.python.org
Fri May 27 02:45:13 EDT 2016


Marco Buttu added the comment:

The error message is misleading:

>>> s = '{names[-1]} loves {0[1]}'
>>> s.format(('C', 'Python'), names=('Dennis', 'Guido'))
Traceback (most recent call last):
    ...
TypeError: tuple indices must be integers or slices, not str

----------
nosy: +marco.buttu

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7951>
_______________________________________


More information about the docs mailing list