faster than list.extend()

Hyunchul Kim hyunchul.mailing at gmail.com
Mon Nov 16 17:30:27 EST 2009


Hi, all.

I want to improve speed of following simple function.
Any suggestion?

**********
def triple(inputlist):
  results = []
  for x in inputlist:
    results.extend([x,x,x])
  return results
**********

Thank you in advance,

Hyunchul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091117/87250645/attachment.html>


More information about the Python-list mailing list