John Machin wrote: >> (if you have 2.4, try replacing [] with () and see what happens) > > The result is a generator with a name ("lst") that's rather misleading > in the context.
according to my dictionary, the word "list" means "A series of names, words, or other items written, printed, or imagined one after the other". I'd say that matches both list objects and iterators pretty well. but alright, you can change the name to "seq" if you want. > Achieving the same result as the list comprehension, by doing lst = list(i for ... etc etc), appears to be slower. the original post didn't contain a complete use case; a generator is a perfect replacement for a list in many cases. I'm sure most comp.lang.python readers are smart enough to understand when and why. </F> -- http://mail.python.org/mailman/listinfo/python-list