New submission from Edward Welbourne <e...@chaos.org.uk>: http://docs.python.org/library/string.html#formatstrings field_name ::= (identifier | integer) ("." attribute_name | "[" element_index "]")* element_index ::= integer
Subsequent text indicates __getitem__() is used but does not overtly say that a string can be used; but http://docs.python.org/whatsnew/2.6.html#pep-3101-advanced-string-formatting gives the example >>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map) and clearly '.mp4' is passed to __getitem__(); a string, not an integer. Clearly one of these is wrong ! Given that the "what's new" doc goes into some detail about how the content of [...] gets parsed, I'm guessing it's right and the grammar is wrong. ---------- assignee: georg.brandl components: Documentation messages: 99340 nosy: eddy, georg.brandl severity: normal status: open title: String formatting: grammar wrongly limits [index] to integer versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7928> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com