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

Irit Katriel report at bugs.python.org
Mon Nov 29 12:18:19 EST 2021


Irit Katriel <iritkatriel at gmail.com> added the comment:

Reproduced on 3.11, and the error message is a little weirder now:

>>> "{0[-1]}".format('fox')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: string indices must be integers, not 'str'

----------
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.4

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


More information about the Python-bugs-list mailing list