On Mon, 19 Jan 2009 14:44:01 +0000, Alan G Isaac wrote:
we are supposed to prefer '{0:>10}'.format('wtf?')
to '%10s' % 'wtf?' and '{{0}}{0}'.format('wtf?').format('wtf?') to '%%s%s' % 'wtf?' % 'wtf?'

On 1/19/2009 10:01 AM Steven D'Aprano apparently wrote:
Well, that second example certainly is a WTF. I think we are supposed to prefer:

'{0}{0}'.format('wtf?')
to '%%s%s' % 'wtf?' % 'wtf?'


But your replacement misses the point of the example,
which is that sequential formatting is often needed.
That is, you need to generate a format string from
a format string.  More explicitly:

'{{0}} {0}'.format('earlyinfo').format('lateinfo')

'%%s %s' % 'earlyinfo' % 'lateinfo'

But of more interest: you claim PEP 4 is not relevant,
and that old string formatting is NOT deprecated.
I would like assurance that it is not deprecated.
Can you back that?

Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to