En Tue, 06 May 2008 08:16:55 -0300, <[EMAIL PROTECTED]> escribió:

> I tend to do ", ".join("%s" % e for e in item)
>
> Is there any difference between this and str()?

Use the timeit module to measure performance:

C:\TEMP>python -m timeit "for i in xrange(10000): str(i)"
10 loops, best of 3: 81.8 msec per loop

C:\TEMP>python -m timeit "for i in xrange(10000): '%s' % i"
10 loops, best of 3: 78.5 msec per loop

The %s version consistently wins in my system -2.5.1 on WinXP- for a wide range 
of inputs.

-- 
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to