PEP 276 -- What else could iter(5) mean?

Emile van Sebille emile at fenx.com
Sun Mar 3 02:58:02 CET 2002


"David Eppstein"
> 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!

Interesting, but even that depends on access mode.  If I open a file to
iterate over it, I certainly expect record 0 to be retrieved first.
OTOH, if I want to add a record, then I want the next _unused_ index.

As for what else iter(5) could mean, it's certainly more interesting to
have it count up to five vs counting up from five!  ;-)

I-have-to-get-back-to-practicing-my-Peano-now-ly y'rs,

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list