iterators (was: python-dev summary)

Steve Purcell stephen_purcell at yahoo.com
Fri Feb 16 09:51:07 CET 2001


Grant Griffin wrote:
> I think Python is at a crossroads where it is changing from "executable
> pseudo-code" into something increasingly...well..."complex".  If
> "growth" in a language means "new features", I guess complexity is
> inevitable.

It's a pity. I also like things simple, because complexity makes my head hurt.

Python is really simple, which is why I love it.

This new proposal sounds 'neat', but just think about plugging the new
iterator syntax into list comprehensions like the following (stolen from the
PEP):

>>> nums = [1,2,3,4]
>>> fruit = ["Apples", "Peaches", "Pears", "Bananas"]
>>> print [(i,f) for i in nums for f in fruit if f[0] == "P" if i%2 == 1]
[(1, 'Peaches'), (1, 'Pears'), (3, 'Peaches'), (3, 'Pears')]

Sprinkle a few ':' iterator magic symbols in there, and it doesn't look like
Python any more. Of course, if the intention is to win over the Perl
community...

-Steve

-- 
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Get servlets at http://pyserv.sourceforge.net/
"Even snakes are afraid of snakes." -- Steven Wright




More information about the Python-list mailing list