Germán L. Osella Massa added the comment:
Well, using negative indexes for fields can be thought as a new feature with
all the consequences mentioned before BUT negative indexes for accessing
elements from a sequence, IMHO, is something that anyone would expected to
work. That's why at
Germán L. Osella Massa added the comment:
I forgot to mention that I also made a patch against py3k (was the same code).
--
___
Python tracker
<http://bugs.python.org/issue7
Changes by Germán L. Osella Massa :
Added file: http://bugs.python.org/file17713/format_negative_indexes-3.2.diff
___
Python tracker
<http://bugs.python.org/issue7
Germán L. Osella Massa added the comment:
I finally managed to get the time to finish the patch that allows negative
indexes inside square brackets so now they work with the same semantics as in a
python expression:
>>> '{0[-1]}'.format(['abc', 'def'])
Germán L. Osella Massa added the comment:
I now see the rationale behind not accepting ' 10 ' == 10. But what about not
accepting '-1' == -1?
I think is odd that negative numbers are not accepted as valid indexes. I'd
expect that something like
"First element
New submission from Germán L. Osella Massa :
The str.format() method allows index lookup on an object that supports
__getitem__(). However, negative indexes are not supported.
Examples (using Python 2.6.5):
>>> "{0[0]}".format([0, 1, 2])
'0'
>>> "