[Python-Dev] PEP 3101 implementation vs. documentation

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Jun 14 02:36:16 CEST 2011

Ben Wolfson wrote:

> If by "item selector" you mean (using the names from the grammar in
> the docs) the element_index, I don't see why this should be the case;
> dictionaries can contain non-identified keys, after all.

Of course they can, but that's not the point. The point is
that putting arbitrary strings between [...] in a format
spec without any form of quoting or requirement for bracket
matching leads to something that's too confusing for humans
to read.

IMO the spec should be designed so that the format string
can be parsed using the same lexical analysis rules as
Python code. That means anything that is meant to "hang
together" as a single unit, such as an item selector,
needs to look like a single Python token, e.g. an integer
or identifier.

I realise this is probably more restrictive than the PEP
suggests, but I think it would be better that way all round.


More information about the Python-Dev mailing list