Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50421
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.032 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'string': 0.09; 'function:': 0.09; 'optimizing': 0.09; 'def': 0.12; 'factory': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'this:': 0.26; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'steven': 0.31; 'skip:d 20': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'surely': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'enough': 0.39; 'here': 0.66; 'jul': 0.74; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=KAhu4WvrySeDbZm7vDXI1yDp8v4tgmdvVF8lzhs0eK4=; b=H+2nVQOjs72JJKQMSrmV4TBzyyuDJOg+GMqiNJ6X6MQ4fXWTAMc5tlRV/lVYJEQXVR UH7SpokBRW+FOWlUjw6JgG7JzEZ6ADd8FL//RbEtzHcGVtdTlbBLh6wC+hLD8TNMxcvQ WzYn1rTTgL5pS8gv2oLi/0ywdqp3zUaZw/L4mmRyY6fNIFw2bVvms4zoNaUJ3qw92MeA kTsZKj3xV2+HLLHMpJOSlAyhIlr/BVi1ZP3cK8g7tc5g8bOcKUoMn+5mDUcK8rQIXoWG p1RiPIrq/ZzRDZXd6tFboIKR+S6D2qto4SpZ60DI/hgVKUayQ3yrUlC+gqbiaZmS8t+r 6Jvg== |
| MIME-Version | 1.0 |
| X-Received | by 10.52.163.165 with SMTP id yj5mr17686609vdb.104.1373526399907; Thu, 11 Jul 2013 00:06:39 -0700 (PDT) |
| In-Reply-To | <51de4b6c$0$11094$c3e8da3@news.astraweb.com> |
| References | <mailman.4558.1373512579.3114.python-list@python.org> <51de4b6c$0$11094$c3e8da3@news.astraweb.com> |
| Date | Thu, 11 Jul 2013 17:06:39 +1000 |
| Subject | Re: Documenting builtin methods |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4571.1373526402.3114.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1373526402 news.xs4all.nl 15985 [2001:888:2000:d::a6]:52764 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:50421 |
Show key headers only | View raw
On Thu, Jul 11, 2013 at 4:06 PM, Steven D'Aprano <steve@pearwood.info> wrote: > I think the right solution here is the trivial: > > def exhaust(it): > """Doc string here.""" > deque(maxlen=0).extend(it) > > > which will be fast enough for all but the tightest inner loops. But if > you really care about optimizing this: > > > def factory(): > eatit = deque(maxlen=0).extend > def exhaust_iter(it): > """Doc string goes here""" > eatit(it) > return exhaust_iter > > exhaust_it = factory() > del factory > > > which will be about as efficient as you can get while still having a > custom docstring. Surely no reason to go for the factory function: def exhaust(it,eatit=deque(maxlen=0).extend): eatit(it) ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Documenting builtin methods Joshua Landau <joshua@landau.ws> - 2013-07-11 04:15 +0100
Re: Documenting builtin methods alex23 <wuwei23@gmail.com> - 2013-07-11 15:35 +1000
Re: Documenting builtin methods Steven D'Aprano <steve@pearwood.info> - 2013-07-11 06:06 +0000
Re: Documenting builtin methods Chris Angelico <rosuav@gmail.com> - 2013-07-11 17:06 +1000
Re: Documenting builtin methods Steven D'Aprano <steve@pearwood.info> - 2013-07-11 07:15 +0000
Re: Documenting builtin methods Chris Angelico <rosuav@gmail.com> - 2013-07-11 17:23 +1000
Re: Documenting builtin methods Joshua Landau <joshua@landau.ws> - 2013-07-12 00:11 +0100
Re: Documenting builtin methods alex23 <wuwei23@gmail.com> - 2013-07-12 13:43 +1000
Re: Documenting builtin methods Joshua Landau <joshua@landau.ws> - 2013-07-12 08:09 +0100
csiph-web