[Python-Dev] str.format implementation
Eric V. Smith
eric at trueblade.com
Tue Dec 13 17:31:41 CET 2011
On 12/12/2011 10:56 PM, Ben Wolfson wrote:
> Hi,
>
> I'm hoping to get some kind of consensus about the divergences between
> the implementation and documentation of str.format
> (http://mail.python.org/pipermail/python-dev/2011-June/111860.html and
> the linked bug report contain examples of the divergences). These
> pertain to the arg_name, attribute_name, and element_index fields of
> the grammar in the docs:
>
> replacement_field ::= "{" [field_name] ["!" conversion] [":"
> format_spec] "}"
> field_name ::= arg_name ("." attribute_name | "["
> element_index "]")*
> arg_name ::= [identifier | integer]
> attribute_name ::= identifier
> element_index ::= integer | index_string
> index_string ::= <any source character except "]"> +
>
> Nothing definitive emerged from the last round of discussion, and as
> far as I can recall there are now three proposals for what kind of
> changes might be worth making:
>
> (1) the implementation should conform to the docs;*
> (2) like (1) with the change that element_index should be changed to
> "integer | identifier" (rendering index_string otiose);
I've now learned what "otiose" means. Thanks!
> (3) like (1) with the change that index_string should be changed to
> '<any source character except "]", "}", or "{">'.
This is still on my plate. I just haven't had a lot of Python time
recently. But I do plan to address this.
Eric.
More information about the Python-Dev
mailing list