Klaas schrieb:
> 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?

Yep. I always forget about the itertools. And then of course we'd go for 
an generator expression, won't we?


Diez
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to