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

Matthew Barnett report at bugs.python.org
Tue Jun 15 03:25:46 CEST 2010


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

Your original:

    "{0[-1]}".format('fox')

is a worse gotcha than:

    "{-1}".format('fox')

because you're much less likely to want to do the latter.

It's one of those things that it would be nice to have fixed, or we could just add a warning to the documentation that it _might_ be fixed in the future, so people shouldn't rely on the current behaviour. :-)

----------

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


More information about the Python-bugs-list mailing list