beliav...@aol.com writes:
> yy = list(chain.from_iterable([list(repeat(aa,nrep)) for aa in xx]))

The chain approach seems more natural to me:

  yy = list(chain.from_iterable(map(lambda x: [x,x], xx)))

may make the doubling more obvious, and in Python 3 it should avoid the
intermediate lists since map creates a generator.  Depending on the
usage, you might also not need the outermost list, making yy a lazy
generator as well.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to