list*list

Klaas mike.klaas at gmail.com
Mon May 1 21:32:31 CEST 2006


Diez wrote:
> First of all: it's considered bad style to use range if all you want is a
> enumeration of indices, as it will actually create a list of the size you
> specified. Use xrange in such cases.

> But maybe nicer is zip:
> c = [av * bv for av, bv in zip(a, b)]

By your logic, shouldn't it also be "bad style" to create an
unnecessary list with zip instead of using izip?

-Mike




More information about the Python-list mailing list