[Python-Dev] Re: accumulator display syntax

Paul Moore pf_moore at yahoo.co.uk
Sat Oct 18 09:18:30 EDT 2003

"Phillip J. Eby" <pje at telecommunity.com> writes:

> Which of course means there'd be little need for imap and ifilter,
> just as there's now little need for map and filter.
> Anyway, if you look at '.. for .. in .. [if ..]' as a ternary or
> quaternary operator on an iterator (or iterable) that returns an
> iterator, it makes a lot more sense than thinking of it as having
> anything to do with generator(s).  (Even if it might be implemented
> that way.)

I've reached the point of skimming this discussion, but this struck a
chord. I think the original proposal (for special syntax for
accumulators) is too limited, and if anything is needed (not clear on
that) it should be a generalised iterator comprehension construct.

In that context, it seems to me that iterator comprehensions bear a
very similar relationship to imap/ifilter to the relationship between
map/filter and list comprehensions.

This signature intentionally left blank

More information about the Python-Dev mailing list