iterators (was: python-dev summary)

Donn Cave donn at u.washington.edu
Fri Feb 16 13:55:27 EST 2001


Quoth Jeremy Hylton <jeremy at alum.mit.edu>:
| >>>>> "EK" == Erno Kuusela <erno-news at erno.iki.fi> writes:
|
| EK> i suspect both map/filter + lambda and list comprehensions are a
| EK> little confusing for the beginner at first, and require some
| EK> pondering. but list comprehensions seem like an unnecessary
| EK> additional way to spell the same thing... at least map/filter
| EK> are pretty straightforward constructions that build on the basic
| EK> concept of function.
|
| As I said before, I think we just don't agree.  List comprehensions
| build on the basic notions of loops and ifs.  I think these are
| simpler than higher-order functions.

The basic notions are simpler, but the notation that puts them
together isn't obvious.  Until I have had a chance to look that
up and use them for something enough to commit that syntax to
memory, I won't understand the list comprehension code I see.
That is not hypothetical, I really don't understand them -
believe I have seen it explained and understood the explanation,
but with no need for such a thing, I have since forgotten.

If it's a big step towards something useful, fine.  I have heard
claims that they're faster, and that's a priority I can understand.
But every time some cool notion gets added to Python, it adds to
the amount that we all eventually have to know.  I can't indefinitely
postpone my education in list comprehensions without marginalizing
myself, just as someone who comes along and learns them right away
will still have to learn all the alternatives too.  Does that add
to our ability to write software, or subtract from it?

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list