.format vs. %
steve+comp.lang.python at pearwood.info
Mon Jan 2 22:47:37 EST 2012
On Mon, 02 Jan 2012 17:51:48 -0800, Rick Johnson wrote:
> You may find the format spec to be cryptic at first. Well, most find
> regexes cryptic also -- but would anyone recommend NOT using regexes
> just because of crypti-ness? I think not. It's a non-starter.
If you have a task that doesn't *need* a regular expression solution,
don't use a regular expression.
For what it's worth, I like the syntax of % formatting. It's nice and
simple and compact while still being readable. format() is more powerful,
but when I don't need that power, I stick to % formatting.
More information about the Python-list