On Jul 28, 1:26 am, ssecorp <[EMAIL PROTECTED]> wrote:
> I might be misunderstanding OP but:
>
> a+b+c+d+e is simple way of concatenating 5 lists...
>
> as a function that takes any amount of lists and concatenates them:
> def concat(*args):
>         c = []
>         for elem in args:
>                 c += elem
>         return c
>
> don't know if extend is faster or slower or the same as + :
>
> def concat(*args):
>         c = []
>         for elem in args:
>                 c.extend(elem)
>         return c
>
> I don't know of a built-in.

Just to infuriate the OP even further, here's the list comprehension
version :)

>>> def concat(*args):
...     return [elem for arg in args for elem in arg]

Hope this helps!
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to