[Python-ideas] Introduce collections.Reiterable

Stephen J. Turnbull stephen at xemacs.org
Tue Sep 24 07:59:03 CEST 2013


Steven D'Aprano writes:

 > Maybe it's the mathematician in me speaking, but I don't think very many 
 > unbounded iterators are found outside of maths sequences.

Nothing *in* math is ever found *outside* of math.  Even the number 0
is unreliable in quantum physics. :-)

In the real world, the use of unbounded math models is intended to
remind us of the fact that the Tokyo Electric Power Company learned
the hard way on March 11, 2011: if you put a practical bound on the
size of tsunamis, soon enough one of size BOUND + 1 comes along.

 > > It would be nice if a program could choose its own value of "too
 > > big", and process "large finite" and "infinite" lists in the same
 > > way by taking "as much as possible".
 > 
 > You can already do that,

Of course we can.  Are we not Men?  No, we are HACKERS.[1] :-)

 > although it requires a bit of manual work and preperation.

Aye, and there's the rub.  But I'll grant it "never is often better
than right now".  And the actual gripe ("re-iteration") hasn't really
been given a math definition yet, and is therefore much harder to
diagnose syntactically.


Footnotes: 
[1]  In Nick's sense, of course.



More information about the Python-ideas mailing list