Terry J. Reedy added the comment:

The doc bug is that the grammar block uses 'integer' (linked to 
https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-integer)
 in
  arg_name          ::=  [identifier | integer]
  element_index     ::=  integer | index_string
when it should use 'decimalinteger' or even more exactly 'digit+'. The int() 
builtin uses the same relaxed rule when no base is given.
>>> 011
SyntaxError: invalid token
>>> int('011')
11
>>> '{[011]}'.format('abcdefghijlmn')
'm'

One possibity is to replace 'integer' in the grammar block with 'digit+' and 
perhaps leave the text alone. Another is to replace 'integer' with 
'index_number', to go with 'index_string, and add the production "index_number 
::= digit+". My though for the latter is that 'index_number' would connect 
better with 'number' as used in the text. A further option would be to actually 
replace 'number' in the text with 'index_number'.


PS to Todd. As much as possible, doc content changes should be separated from 
re-formatting. I believe the first block of your patch is purely a re-format

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7951>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to