How to create a tuple quickly with list comprehension?

Marc 'BlackJack' Rintsch bj_666 at
Wed Jun 13 12:37:02 CEST 2007

In <5d9ngkF32j8imU1 at>, Diez B. Roggisch wrote:

> No need to create the intermediate list, a generator expression works just
> fine:
> a = tuple(i for i in range(10))

But `range()` creates the intermediate list anyway.  ;-)

a = tuple(xrange(10))


	Marc 'BlackJack' Rintsch

More information about the Python-list mailing list