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

Eric Smith report at bugs.python.org
Sat Mar 14 02:19:27 CET 2009


Eric Smith <eric at trueblade.com> added the comment:

Should string.Format also support auto-numbering?

It seems like it should, but I'm not convinced it's possible without
modifying the signatures to the public methods, in particular
get_field(). The design of string.Format doesn't support state that is
created in format() or vformat() and is passed in to get_field(). I
could use object state in the string.Format instance, but that doesn't
work well, due to the fact that format() can be called multiple times
per instance lifetime. string.Format really needs to have no state of
its own, for example in the case where a single instance is being used
by multiple threads or if it calls the same instance of itself
recursively. I'm going to punt on this for now.

----------

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


More information about the Python-bugs-list mailing list