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

2010-06-25 Thread Germán L . Osella Massa
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

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

2010-06-18 Thread Germán L . Osella Massa
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

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

2010-06-18 Thread Germán L . Osella Massa
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

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

2010-06-18 Thread Germán L . Osella Massa
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'])

[issue8985] String format() has problems parsing numeric indexes

2010-06-13 Thread Germán L . Osella Massa
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

[issue8985] String format() has problems parsing numeric indexes

2010-06-12 Thread Germán L . Osella Massa
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' >>> "