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

Matthew Barnett report at bugs.python.org
Fri Feb 19 02:43:31 CET 2010


Matthew Barnett <python at mrabarnett.plus.com> added the comment:

On a related note, this doesn't work either:

>>> "{-1}".format("x", "y", "z")
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    "{-1}".format("x", "y", "z")
KeyError: '-1'

It could return "z".

It also rejects a leading '+', but that would be optional anyway.

----------
nosy: +mrabarnett

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


More information about the Python-bugs-list mailing list