[Python-Dev] Shall I start adding iterators to Python 2.2?
Barry A. Warsaw
barry@digicool.com
Fri, 20 Apr 2001 12:13:07 -0400
>>>>> "GvR" == Guido van Rossum <guido@digicool.com> writes:
GvR> My question is: should I just merge this code onto the trunk
GvR> (making it part of 2.2), or should we review the design more
GvR> before committing to this implementation?
I would definitely like to play with this stuff so I'd be generally +1
at committing your changes to the trunk. Let me make two comments.
First, Ping or Guido should update the PEP, especially to describe the
`non-controversial' parts (using .next(), StopIteration -- where's
this exception in the hierarchy, btw?). You should also update the
Open Issues section.
Second, I'm still not totally comfortable with the "for keys:values in
dict" part of the proposal, especially with the elaboration of letting
either keys or values be missing. An alternative, which I sure has
been raised, but which isn't in the PEP, is to allow an alternative
pseudo-keyword in the `in' position. For example, allow "over" which
has the semantics when used with a dict of iterating over keys.items()
and when iterating over a sequence has the semantics of iterating over
zip(range(len(a)), a). Thus only this would be allowed:
for key, value over dict:
for index, item over seq:
I think it would be fine if you don't support optional untupling parts
in the target.
-Barry