"Raymond Hettinger" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In all probability, both list comprehensions and generator expressions > will be around in perpetuity. List comps have been a very successful > language feature. > > The root of this discussion has been the observation that a list > comprehension can be expressed in terms of list() and a generator > expression. However, the former is faster when you actually want a > list result and many people (including Guido) like the square brackets. > > After the advent of generators, it seemed for a while that all > functions and methods that returned lists would eventually return > iterators instead. What we are learning is that there is a place for > both. It is darned inconvenient to get an iterator when you really > need a list, when you want to slice the result, when you want to see a > few elements through repr(), and when you need to loop over the > contents more than once.
I was wondering about what seemed like an ill-concieved rush to make everything an iterator. Iterators are, of course, useful but there are times when you really did want a list. John Roth > > > Raymond Hettinger > -- http://mail.python.org/mailman/listinfo/python-list