generator expressions: performance anomaly?

Ola Natvig ola.natvig at infosense.no
Tue Jan 18 09:16:04 EST 2005


> 
> What makes the leftmost expression different from the iterable returning
> expression inside the for? The same arguments apply there.
> 

It's not different, but it's a requirement that the iterable returns the 
same data every time. I know that anyone can type range = fancyRange and 
make this return a random number of random items.

But if that happens the expression cannot be transformed into a static 
list / tuple. Thats obvious.



More information about the Python-list mailing list