output from external commands

Terry Hancock hancock at anansispaceworks.com
Mon Oct 24 21:25:45 CEST 2005

On Monday 24 October 2005 11:24 am, Peter Hansen wrote:
> Answering narrowly, the difference is that using "%s" calls str() on the 
> items in the result list, while your suggestion does not.  ("Why not 
> just use str(f) instead of the less clear '%s' % f?" would be a valid 
> question too though.)

The answer to which, in my experience, is to provide consistency with
code that uses a non-trivial format string, such as '"Error: %s" % f',
and/or to suggest to future developers (including me) that this is the
"right" way to make such changes.

Note also that for those who count, "str(f)" is exactly as long
(in keystrokes) as "'%s'%f", making the "just" a matter of opinion.

Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com

More information about the Python-list mailing list