[Tutor] String formatting question.

Steve Willoughby steve at alchemy.com
Thu Mar 31 18:51:59 CEST 2011

On 31-Mar-11 09:46, bob gailer wrote:
> IMHO % formatting is the easiest to use and understand.
> I am sorry that it has been slated for removal.

I had the same reaction, but I think it was mostly because of my long 
background as a C programmer, since it's essentially the equivalent of 
printf() formatting.  Just heavily ingrained in my brain.

However, since the more recent Python 2 versions have supported 
str.format(), and anticipating their removal from Python 3, I have 
started gravitating more to them, and I have to admit they're more 
powerful and probably a good evolutionary step to take.  Especially so 
if your formats are configurable or generated by code which may want to 
reorder the values.

Steve Willoughby / steve at alchemy.com
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 48A3 2621 E72C 31D9 2928 2E8F 6506 DB29 54F7 0F53

More information about the Tutor mailing list