Author terry.reedy
Recipients Todd.Rovito, docs@python, eric.araujo, eric.smith, flox, gosella, kisielk, mark.dickinson, mrabarnett, rhettinger, terry.reedy
Date 2014-04-13.23:43:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1397432610.84.0.465837716319.issue7951@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2014-04-13 23:43:30terry.reedysetrecipients: + terry.reedy, rhettinger, mark.dickinson, eric.smith, kisielk, eric.araujo, mrabarnett, flox, docs@python, gosella, Todd.Rovito
2014-04-13 23:43:30terry.reedysetmessageid: <1397432610.84.0.465837716319.issue7951@psf.upfronthosting.co.za>
2014-04-13 23:43:30terry.reedylinkissue7951 messages
2014-04-13 23:43:30terry.reedycreate