Eric Smith <e...@trueblade.com> added the comment: Terry J. Reedy wrote: > Terry J. Reedy <tjre...@udel.edu> added the comment: > > All I am requesting is that > '{} {} {}'.format(3, 'pi', 3.14) work as > >>>> '%s %s %s' % (3, 'pi', 3.14) > '3 pi 3.14' >>>> '{0} {1} {2}'.format(3, 'pi', 3.14) > '3 pi 3.14' > > do today (3.0).
My string.Formatter subclass (attached to this bug report) does do this: $ ./python.exe Python 2.7a0 (trunk:69516, Feb 11 2009, 14:30:31) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from auto_number_formatter_1 import MyFormatter >>> f = MyFormatter() >>> f.format('{} {} {}', 3, 'pi', 3.14) '3 pi 3.14' >>> This is just for vetting the concept, if it's accepted I'll modify ''.format(). It's not a huge change. I just want to make sure that this implements what people are expecting. The talk about '{:d}' and the like is just to make sure all the cases are addressed. I doubt it would often be used that way. > I should note that the difference between typing {}, which is easy, and > {1}, is more than just one keystroke because the latter requires > unshift-1-shift Agreed. _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5237> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com