Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'subject:not': 0.03; 'builtin': 0.09; 'subject:Why': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'mostly': 0.14; '(actually': 0.16; 'benjamin': 0.16; 'itertools': 0.16; 'url:file': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'module': 0.19; 'thu,': 0.19; 'written': 0.21; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'documented': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'equivalent': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'function': 0.29; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'usually': 0.31; 'probably': 0.32; 'url:python': 0.33; 'subject:the': 0.34; "i'd": 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'combination': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'list': 0.37; 'pm,': 0.38; 'easy': 0.60; 'most': 0.60; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'covers': 0.68; 'describes': 0.84; 'oscar': 0.84; 'understand,': 0.84; 'url:cpython': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=UClx/9pd00Hybn+XaDhsEBVQDkDpbyJwuhbTJaJLgSQ=; b=pKY9L6l8wel9pes3b6RTO/BrshxqAeHOXslvhi7cXGdQ+dac5JbYrTSe/ODo+GDAUD SLeZO4yPQFc3DwVkz/6hjG5Xd+kw7bZaLR3lWHyTWHiYlgvduilx6exTtI2MyeDxrY+f 1g00dqhODBZPx8Lqx8VjQs1H/RBS/Vh4VsQuRQAhi24eIaXOHS2AMR2RmCsCXgci+Yef OG5a5FG6Mck0aGR9x2lAZVkkR3BtHQNB+skhe/qkl+a++bGN8PxuQWX08IHcxb4i3rb0 TBEzDucqON2A7t9zt4ExKTfrJemFqrlC/W7cYrji2DuQ72Xz5IaYMhFyGKjNgTk17T52 aRkw== X-Received: by 10.58.220.129 with SMTP id pw1mr2147047vec.32.1367501057344; Thu, 02 May 2013 06:24:17 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <5181f679$0$29882$c3e8da3$5496439d@news.astraweb.com> From: Oscar Benjamin Date: Thu, 2 May 2013 14:23:57 +0100 Subject: Re: Why chunks is not part of the python standard lib? To: Chris Angelico Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367501060 news.xs4all.nl 16012 [2001:888:2000:d::a6]:60378 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44623 On 2 May 2013 13:55, Chris Angelico wrote: > On Thu, May 2, 2013 at 10:52 PM, Oscar Benjamin > wrote: >> They are all easy to write as generator functions but to me the point >> of itertools is that you can do things more efficiently than a >> generator function. Otherwise code that uses a combination of >> itertools primitives is usually harder to understand than an >> equivalent generator function so I'd probably avoid using itertools. > > Aren't most of the itertools primitives written in Python anyway? If > your code is harder to understand, just write the generator function! The documentation describes them by showing equivalent generator functions and there may be a pure Python version of the module but if you look here then you can see which are builtin for CPython: http://hg.python.org/cpython/file/c3656dca65e7/Modules/itertoolsmodule.c#l4070 The list covers all of the documented itertools functions (actually I now realise that they're mostly types not functions). Oscar