Inserting while itterating

Paul Rubin http
Sat Jan 17 23:09:27 EST 2004


Jeremy Bowers <jerf at jerf.org> writes:
> Actually, maximal readability is
> 
> l[:] = [x for x in range(min(l), max(l) + 1)]
> 
> but that will *certainly* be less efficient if you know the list is sorted
> then my first post.

Um, why the list comprehension?  Something wrong with

  l[:] = range(min(l), max(l) + 1)

?



More information about the Python-list mailing list