dict view to list

Tim Hoffman zutesmog at gmail.com
Mon Mar 30 19:29:46 EDT 2009


Hi Larry

I actually feel this is a bad idea, (that is making list() a method of
all iterators)
because quite often iterators are created that don't end.

What happens then, is you have a method that will intentionally cause
you to run out of memory
or you exclude it from such iterators (creating inconsistancies in a
standard protocol. Ok you can do the same silly thing with list
(infiniteiterator) but
a list() method on an iterator is just plain wrong in such a
circumstance, don't you think

Regards

Tim

On Mar 31, 6:07 am, Larry Riedel <larryrie... at gmail.com> wrote:
> I see list(x.f()) as like x.f().iter().list(), where "list()"
> is a method of all "iterator" objects, and "iter()" is a method
> of all "iterable" objects, and whatever object is returned by
> x.f() is of a type which conforms to the "iterable" interface.
> I am not saying this is the way things /should/ be, but if it
> was, it would make sense to me.
>
> Larry




More information about the Python-list mailing list