Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'skip:` 10': 0.07; 'observation': 0.09; 'def': 0.12; 'iterable"': 0.16; 'iterable)': 0.16; 'iterators': 0.16; 'objection': 0.16; 'return,': 0.16; 'subject:slow': 0.16; 'supported.': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'seems': 0.21; 'email addr:gmail.com>': 0.22; '>': 0.26; 'supported': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'not.': 0.33; 'problem.': 0.35; 'received:google.com': 0.35; 'sequence': 0.36; "i'll": 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'ian': 0.60; 'is.': 0.60; 'further': 0.61 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=+sAnzKLEj6tF0B+gkcTNmh7MSJ2Mm2ghAdQIewGZ1Oc=; b=iX18ceEmVqDcl6UHaroD26WS4Vwac0djD9El8hHoEvqoODLL0Pg3xGb4BnXWzG/QM2 8qo5QBM00dibZDEOOizuYoMSNfNXMnkbY+LXryrMUQqk3sv3K6jwj2ZjobMg4gHJup9S qImGAjeFR7dIuHu7YRUpn3VsKwz5Pz7ju2piLEe91DcLD6M7p283Vf3iPjiK2mNf2wEr ET2LjZ95d7lJfOWNkH3rBb2Ua1ogeM8KQKUUwzKcmZdM7rH4+YSX9baKvR+auMeiKZ+p W0cbKftxlihSaxiqS2HdsKitrL4mUVUFY1ndUr3xUZYZqFYSyP2wBI6V+QxjHVtnvosO nOQw== X-Received: by 10.68.162.100 with SMTP id xz4mr8570333pbb.138.1418227673662; Wed, 10 Dec 2014 08:07:53 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <20141210052025.GA84184@FuzzyHorror> From: Ian Kelly Date: Wed, 10 Dec 2014 09:07:13 -0700 Subject: Re: Nested loops is strangely slow, totally at a loss. To: Python Content-Type: multipart/alternative; boundary=047d7ba96d9cb30bc50509dedcca X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418227676 news.xs4all.nl 2872 [2001:888:2000:d::a6]:45251 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4931 X-Received-Body-CRC: 3157691412 Xref: csiph.com comp.lang.python:82291 --047d7ba96d9cb30bc50509dedcca Content-Type: text/plain; charset=UTF-8 On Wed, Dec 10, 2014 at 9:01 AM, Ian Kelly 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. --047d7ba96d9cb30bc50509dedcca Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
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):
&g= t; =C2=A0 =C2=A0 return sum(1 for item in iterable)
>
> My obse= rvation is that seems strange to me that one standard sequence operation sh= ould 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 i= terable" already is.
--047d7ba96d9cb30bc50509dedcca--