Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82291
| References | <20141210052025.GA84184@FuzzyHorror> <CAPTjJmrM_nrGhPn2Le7b0iDOL5V035SOE3kVg98_89dVjueynA@mail.gmail.com> <CALwzid=vEcxcyxSN+8jXgC0VNKFBKNz5vZF+MrD7maGh0ECGAg@mail.gmail.com> <m68vqn$74v$1@ger.gmane.org> <CALwzid=EL8-CyQnkebL5nQeNb5nDNzZGBWE1TMPdvaTiERt1nw@mail.gmail.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2014-12-10 09:07 -0700 |
| Subject | Re: Nested loops is strangely slow, totally at a loss. |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16812.1418227676.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On Wed, Dec 10, 2014 at 9:01 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote: > This also seems perfectly natural: > > def len(iterable): > return sum(1 for item in iterable) > > My observation is that seems strange to me that one standard sequence operation should be supported for arbitrary iterators and the other not. > > If the objection about `len(count())` is that the call would never return, I'll point out that `-42 in count()` suffers the same problem. To further clarify what I'm saying, I don't think that len(iterable) should be supported. I'm just dismayed that "x in iterable" already is.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Nested loops is strangely slow, totally at a loss. Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-10 09:07 -0700
csiph-web