Author petri.lehtinen
Recipients Ben.Wolfson, eric.araujo, eric.smith, mark.dickinson, petri.lehtinen, r.david.murray
Date 2011-06-03.18:25:21
SpamBayes Score 6.2704e-05
Marked as misclassified No
Message-id <20110603182518.GA1767@ihaa>
In-reply-to <1307122877.46.0.696455719004.issue12014@psf.upfronthosting.co.za>
Content
I've played around with the str.format() code for a few weeks now, to
investigate its poor performance compared to the % operator.

Having written a few parsers before, I would change it to parse each
part separately:

1. field_name
2a. if followed by '[': element_index (anything until ']')
2b. elif followed by '.': attribute_name
3. if followed by '!': conversion
4. if followed by '}': format_spec (anything until '}')

It seems to me that the documentation also suggests this behavior, and
that this bug report is correct.

What comes to parsing identifiers, it seems to me that stopping at
'.', ']', and '}' is not enough. In field_name, '[', ':' and '!' would
also be needed, and ':' and '!' in attribute_name. It's a shame that
PEP3101 is so vague on this subject.
History
Date User Action Args
2011-06-03 18:25:22petri.lehtinensetrecipients: + petri.lehtinen, mark.dickinson, eric.smith, eric.araujo, r.david.murray, Ben.Wolfson
2011-06-03 18:25:22petri.lehtinenlinkissue12014 messages
2011-06-03 18:25:21petri.lehtinencreate