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

Eric V. Smith report at bugs.python.org
Fri Apr 26 02:56:04 EDT 2019


Eric V. Smith <eric at trueblade.com> added the comment:

I'm not sure where (or if) it's defined in the Python docs, but in PEP 3101 it's in https://www.python.org/dev/peps/pep-3101/#simple-and-compound-field-names: "It should be noted that the use of 'getitem' within a format string is much more limited than its conventional usage. In the above example, the string 'name' really is the literal string 'name', not a variable named 'name'. The rules for parsing an item key are very simple. If it starts with a digit, then it is treated as a number, otherwise it is used as a string.".

----------

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


More information about the docs mailing list