Author petri.lehtinen
Recipients Ben.Wolfson, eric.araujo, eric.smith, mark.dickinson, petri.lehtinen, r.david.murray
Date 2011-06-04.18:03:23
SpamBayes Score 3.03727e-09
Marked as misclassified No
Message-id <20110604180320.GA1857@ihaa>
In-reply-to <>
> PEP 3101 defines format strings as intermingled character data and markup. Markup defines replacement fields and is delimited by braces. Only after markup is extracted does the PEP talk about interpreting the contents of the markup.
> So, given "{0[a}b]}" the parser first parses out the character data and the markup. The first piece of markup is "{0[a}". That gives a syntax error because it's missing a right bracket.
> I realize you'd like the parser to find the markup as the entire string, but that's not how I read the PEP.

This is a good point, although the support of further replacement
fields inside format_specifiers requies the parser to count matching
braces, if the markup is to be extracted before its interpreted.

But disallowing unmathced '}' inside the replacement field doesn't
still explain why this shouldn't work:

    '{0[!]!r}'.format({'!': 'foo'})

I'm completely fine with disallowing '}', but it seems to me that
there's absolutely no reason to not parse the element_index and later
fields correctly with respect to '!' and ':'.
Date User Action Args
2011-06-04 18:03:24petri.lehtinensetrecipients: + petri.lehtinen, mark.dickinson, eric.smith, eric.araujo, r.david.murray, Ben.Wolfson
2011-06-04 18:03:23petri.lehtinenlinkissue12014 messages
2011-06-04 18:03:23petri.lehtinencreate