iterators (was: python-dev summary)

Erno Kuusela erno-news at
Fri Feb 16 17:42:09 CET 2001

In article <mailman.982340500.13146.python-list at>, Jeremy
Hylton <jeremy at> writes:

| Erno Kuusela <erno-news at> writes:
|| list comprehensions also look pretty obscure to me (compared to
|| the rest of python's syntax), and don't do a lot that you can't
|| do with map/filter now that we have lexical scoping.

| I have the opposite opinion.  I think the list comprehension syntax is
| often clearer and more intuitive than the equivalent map or filter
| expression.  I expect more non- and novice programmers will be
| familiar with set construction notation than with higher-order
| functions like map.

i suspect both map/filter + lambda and list comprehensions are
a little confusing for the beginner at first, and require some
pondering. but list comprehensions seem like an unnecessary
additional way to spell the same thing... at least map/filter
are pretty straightforward constructions that build on the
basic concept of function.

also, i find the lack of delimiters between tha parts in
a list comprehension a little un-aesthetic.
[a*b   for b in c   if d % 2]
     ^            ^
  -- erno

More information about the Python-list mailing list