Suggested coding style

Chris Angelico rosuav at gmail.com
Fri Sep 30 02:35:02 EDT 2011


On Fri, Sep 30, 2011 at 4:14 PM, Westley Martínez <anikom15 at gmail.com> wrote:
> I'm one of the weirdos who is absolutely hostile to the format method
> and continues to use % formatting.  I'm pretty sure it is because of my
> C background (actually I learned Python before C, and thus learned %
> formatting in Python).

I quite like printf-style formatting. It's well known, well defined,
and compact. When I write C++ programs, I often still use
printf/sprintf extensively - it just "feels nicer" than iostream (and
the main downside of printf, the lack of argument checking, is largely
solved in recent gcc). So when I work with Python, it makes sense to
use the same thing there. Dense syntax results in easy-to-read format
strings, imho.

ChrisA



More information about the Python-list mailing list