On 2017-10-31, Stefan Ram <r...@zedat.fu-berlin.de> wrote: > Neil Cerutti <ne...@norwich.edu> writes: >>You can use the % operator instead of +, and a generator >>expression instead of map. It's a pretty small improvement, >>though. > > "Improvement" in what sense? > > C:\>python -m timeit -s "value_list = [1, 2, 3, 4, 56, 's']" "values = '||' > + '||'.join(map(str, value_list)) + '||'" > 100000 loops, best of 3: 4.86 usec per loop > > C:\>python -m timeit -s "value_list = [1, 2, 3, 4, 56, 's']" "values = > '||%s||' % ('||'.join(str(s) for s in value_list))" > 100000 loops, best of 3: 7.46 usec per loop
Hmmm.... minty freshness? -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list