Iterator / Iteratable confusion

Michael Spencer mahs at telcopartners.com
Thu Feb 17 00:21:23 EST 2005


Adam DePrince wrote:


> How is a spencerator [an iterator that doesn't return itself unmodified on iter]
 > different than itertools.tee?
> 
Taking your question literally, it changes the behavior of an itertools.tee 
object 'tee', so that iter(tee) returns tee.__copy__(), rather than tee itself.

It was created for rhetorical purposes and has no known practical application.

Depending on your point of view it is evidence either for (a) why the iterator 
protocol must be strictly adhered to, or (b) that iterators and iterables cannot 
be disjoint sets.


Michael






More information about the Python-list mailing list