[issue5237] Allow auto-numbered replacement fields in str.format() strings
Eric Smith
report at bugs.python.org
Sat Feb 14 11:03:51 CET 2009
Eric Smith <eric at trueblade.com> added the comment:
auto_number_formatter_2.py lets you experiment with this with a syntax
more similar to what ''.format() looks like:
$ ./python
Python 2.7a0 (trunk:69608, Feb 14 2009, 04:51:18)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from auto_number_formatter_2 import formatter as _
>>> _('{} {} {}').format(3, 'pi', 3.14)
'3 pi 3.14'
>>>
It still doesn't handle escaping '{' and '}', but is otherwise complete.
If the consensus is that this is useful, I'll implement it in
''.format(), otherwise I'm done with this issue.
Added file: http://bugs.python.org/file13081/auto_number_formatter_2.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5237>
_______________________________________
More information about the Python-bugs-list
mailing list