PEP 234: Iterators

Stephen Hansen news at myNOSPAM.org
Thu May 3 20:44:17 EDT 2001


    Oh. I was confused. Hmm, then I don't see a problem.. both forms end up
with the same result, they just support different types of input. That's
pythonic :) Give it an object, it returns the iterator; give it a function,
and it returns the iterator... the function bit just needs some more
information.

    dict.iteritems/iterkeys/itervalues is still really ugly, though. :)

--S :)
"Thomas Bellman" <bellman at lysator.liu.se> wrote in message
news:9crjks$9kn$1 at newsy.ifm.liu.se...
> "Stephen Hansen" <news at myNOSPAM.org> wrote:
>
> >     I'd like to read 'iter(object)' as 'iterate(object)' and 'iter(func,
> > sequence)' as 'iterator(func, sequence)' since the latter is making an
> > iterator on the fly, and not iterating over it...
>
> But the former *doesn't* iterate over the sequence.  It *also*
> instantiates (creates) an iterator.  The *for* statement and the
> *map()* function iterates; the iter() function (whatever spelling)
> doesn't, so it shouldn't be called iterate().
>
> >                                                   but that really
doesn't
> > matter, i'd much rather just see 'iterate' for both of them. Perhaps it
> > would be better to 'traverse(iterator-object)' and then 'iterator(func,
> > sequence)'. In fact, that's my favorite option.. getting rid of the
> > excessive use of 'iter' and just calling it 'traverse'.
>
> Same problem with the name traverse().
>
>
> --
> Thomas Bellman,   Lysator Computer Club,   Linköping University,  Sweden
> "I don't think [that word] means what you    !  bellman @ lysator.liu.se
>  think it means."   -- The Princess Bride    !  Make Love -- Nicht Wahr!





More information about the Python-list mailing list