
sum([lazy x*x for x in sequence])
I like this the best of suggestions so far. Easy to understand, easy to teach: [lazy ...] = iter([...]) but produced more efficiently
-1. An iterator is not a lazy list. A lazy list would support indexing, slicing, etc. while calculating its items on demand. An iterator is inherently sequential and single-use -- a different concept. But maybe some other keyword could be added to ease any syntactic problems, such as "all" or "every": sum(all x*x for x in xlist) sum(every x*x for x in xlist) The presence of the extra keyword would then distinguish an iterator comprehension from the innards of a list comprehension. Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+