PEP 276 -- What else could iter(5) mean?
Gonçalo Rodrigues
op73418 at mail.telepac.pt
Sat Mar 2 21:08:18 EST 2002
On Sat, 02 Mar 2002 17:47:00 -0800, David Eppstein
<eppstein at ics.uci.edu> wrote:
>Here's another way of looking at the same question.
>An iterable object has a next() function, that's what it means to be
>iterable. If numbers are iterable, we can call number.next(), right?
>So what should 5.next() be? Surely anyone familiar with the Peano axioms
>would say 6, not 0!
As far as i understand 3.next() should give an error. 3 is iterable,
that is, it delivers an iterator in the appropriate context, it is NOT
the iterator itself. To get 0 you would have to do iter(3).next()
P.S: I am a newbie. I like this PEP proposal.
More information about the Python-list
mailing list