Message137568
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. |
|
Date |
User |
Action |
Args |
2011-06-03 18:25:22 | petri.lehtinen | set | recipients:
+ petri.lehtinen, mark.dickinson, eric.smith, eric.araujo, r.david.murray, Ben.Wolfson |
2011-06-03 18:25:22 | petri.lehtinen | link | issue12014 messages |
2011-06-03 18:25:21 | petri.lehtinen | create | |
|