Idiomatic way of repeating items in a sequence.

alr anlri at wmdata.com
Wed Jul 2 04:28:39 EDT 2003


Wow, tanks for alle the replies. My favourite is John Hunters/Bob
Gailers solution ([x for x in seq for i in range(repetitions)]). I had
forgotten that you could have nested for statements in list
literals... Aahz's point is taken. I happen to need to repeat lists of
strings (which are immutable), but that's not what i asked about now
is it. :-)

-- 
Regards
André Risnes




More information about the Python-list mailing list