[issue5237] Allow auto-numbered replacement fields in str.format() strings

Nick Coghlan report at bugs.python.org
Sat Mar 14 03:50:27 CET 2009


Nick Coghlan <ncoghlan at gmail.com> added the comment:

Only Formatter.format_field() is particularly hard to override at the
moment (for the same reason that __format__() methods are tricky to
write). That said, creating a locale aware version of string formatting
based on string.Formatter is such an obvious idea that I would actually
be surprised if someone *hasn't* done it by now (they may not have
published it anywhere, but I expect someone has implemented it for their
own use).

That said, I think it's OK for string.Formatter to lag the actual
str.format implementation when it comes to features like this. I see it
as similar to the formatting mini-language parser problem: the primary
goal is to have a good implementation and syntax for str.format, while
providing the tools to allow people to create alternative formatters
with similar power is secondary.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5237>
_______________________________________


More information about the Python-bugs-list mailing list