[Python-3000] Please don't kill the % operator...
Greg Ewing
greg.ewing at canterbury.ac.nz
Fri Aug 17 03:36:51 CEST 2007
skip at pobox.com wrote:
> "{0} asks {1} if he is happy to see {1}".format('Brett', 'Skip', 'Christian')
>> ^^^ whoops
This kind of mistake is easy to spot if the format
string is short.
If it's not short, it would be better to use names:
"{asker} asks {askee} if he is happy to see {friend}".format(
asker = 'Brett', askee = 'Skip', friend = 'Christian')
--
Greg
More information about the Python-3000
mailing list