New GitHub issue #95088 from FrankMillman:<br>
<hr>
<pre>
The section headed Format String Syntax has the following -
`An expression of the form '.name' selects the named attribute using [getattr()], while an expression of the form '[index]' does an index lookup using __getitem__().`
An expression of the form [1] correctly returns the element in position 1. An expression of the form [-1] fails with TypeError: list indices must be integers or slices, not str.
Discussion on python-list led to unearthing this quote from PEP3101 - Advanced String Formatting -
`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. `
It was felt that the documentation would be improved if this rule was made explicit.
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/95088">View on GitHub</a>
<p>Labels: docs</p>
<p>Assignee: </p>