[Python-ideas] Make len() usable on a generator

Thomas Chaumeny t.chaumeny at gmail.com
Fri Oct 3 19:43:23 CEST 2014


I searched this list before I asked and couldn't find anything.

Anyway, I understand from Nick's response that len() is conceived for
collections which have a size computable in constant time (I suppose
structures that maintain some inner attribute to store their length). I
also believe that "length" sounds more like an attribute name than a name
for something which really does some computation ("count" sounds more
appropriate for that). On the other hand, it doesn't seem to be a general
concern not to provide construction which can lead to hidden complexity
cost (like "in" used on a list vs a set).

On Fri, Oct 3, 2014 at 7:05 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:

> Thomas Chaumeny schrieb am 03.10.2014 um 17:09:
> > What do you think ?
>
> You can read the answers in the previous discussion threads on this list
> (and on python-list, and IIRC the py3k list, and maybe python-dev, too)
> that deal with exactly this proposal.
>
> Stefan
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20141003/d105b0d4/attachment.html>


More information about the Python-ideas mailing list