[Python-ideas] Introduce collections.Reiterable
timothy.c.delaney at gmail.com
Sat Sep 21 02:18:26 CEST 2013
On 21 September 2013 10:05, Tim Delaney <timothy.c.delaney at gmail.com> wrote:
>> Dismissing legal code as 'pathological', as more than one person has,
>> does not cut it as a design principle.
> To me, that is a reiterable. It might not give the same results each time
> through, but you can iterate, it stops, then you can iterate over it again
> - it won't raise an exception trying to do so. So not what I would consider
> a pathological case - though definitely an unusual case and one that
> obviously wouldn't work in many situations that require reiterables to
> return the same values in the same order each time through.
> So we've got two classes of reiterables here
> - anything that can be iterated through, and then iterated through again,
> for which obj is not iter(obj) will work in all but what I consider to be
> pathological cases;
> - iterables that can be iterated through multiple times, returning the
> same objects in the same order each time through, for which I don't think a
> test is possible.
Also, pathological is probably not the best term to use. Instead,
substitute "deliberately breaks a well-established protocol". It may make
sense to do so in certain circumstances, but you can't expect anyone else
to play nice with you if you don't play nice with them.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas