Idiomatic way of repeating items in a sequence.

John Hunter jdhunter at
Mon Jun 30 17:58:15 CEST 2003

>>>>> "alr" == alr  <anlri at> writes:

    alr> reduce(lambda l, i: l + i, [[item] * repetitions for item in

This doesn't look too bad to me, but perhaps list comprehensions are

  seq = ['a', 'b', 'c']
  print [x for x in seq for x in seq]

More information about the Python-list mailing list