PEP0238 lament

Terry Reedy tjreedy at home.com
Tue Jul 24 11:29:25 EDT 2001


> 3.  I dislike % substitution because I dislike sprintf formatting,
and
>     besides - I tend to think it should specify the subscript for
the
>     data to substitute in the string - not just rely on the
list/tuple
>     order.

Off the subject of the thread, but ...

Are you aware of substitution by name and dictionary?  For instance

quot,rem = divmod(amount,100)
print 'most = %(quot)d, rest = %(rem)d' % locals()

These is easy to miss the first time thru the docs (oh, just like
sprintf),
and underutilized in quickly-written posted examples.

Terry J. Reedy





More information about the Python-list mailing list