.format vs. %

Chris Angelico rosuav at gmail.com
Tue Jan 3 08:04:31 EST 2012


On Tue, Jan 3, 2012 at 10:47 PM, Stefan Krah <stefan-usenet at bytereef.org> wrote:
> For me the %-style is much more readable.

It's also very similar to C's printf, which means it's similar to
everything else that's similar to printf. That makes it instantly
grokkable to many many people, which is a Good Thing. It's like using
the + operator for string concatenation - there's no requirement to do
so, and not all languages do (REXX, PHP, and SQL come to mind); but
supporting the "obvious thing" gives a huge slab of potential Python
users the chance to understand and write code with one less trip to
the documentation.

ChrisA



More information about the Python-list mailing list