Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!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.118 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.77; '*S*': 0.00; 'caching': 0.16; 'collections': 0.16; 'deque': 0.16; 'iterator': 0.16; 'sender:addr:gmail.com': 0.17; 'obviously': 0.18; 'import': 0.22; 'creating': 0.23; 'code:': 0.26; 'message-id:@mail.gmail.com': 0.30; 'work.': 0.31; '(which': 0.31; 'to:name:python-list': 0.33; 'skip:d 20': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'to:addr:python-list': 0.38; 'rather': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'new': 0.61; 'simply': 0.61; 'simple': 0.61; 'yielded': 0.84; 'inefficient': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:x-google-sender-auth:message-id :subject:to:content-type; bh=gN9KTE7336friZXj9NJcVuNTYfMXrcHHULJjlTXzyCE=; b=MDvMRonG4bqx0f2BKjn82lNft0lkVeG9F1zil8ex3stS8lBfhtcwGxZ00SsV+UHb5+ IvS3JEWkR7LjDlwEnDOeC7TfjXVscNJyJlK9kiSM6Te/llGYBKW8CQsTfS2+ZyVGziCU OAcpZfegWf83d96NIM9LoY/pn3oVVOsCBl5l8eGoW1/PdLQZFLjGEa3kX+6x55JhJU2l e1c1Xmz5uGiyRjdGeBRNG4krokrh0VJAwib2sR+QtexWersegzgiGm1z3BNXZ7l/yTyQ B2LeJ6SzSbThc2TWlfZudFClBMZIoIIh9lBWwnJWOWdN6ExE1dUREKBknj5tAammXrE1 5D1w== X-Received: by 10.112.182.39 with SMTP id eb7mr16153418lbc.30.1373512577912; Wed, 10 Jul 2013 20:16:17 -0700 (PDT) MIME-Version: 1.0 Sender: joshua.landau.ws@gmail.com From: Joshua Landau Date: Thu, 11 Jul 2013 04:15:37 +0100 X-Google-Sender-Auth: y7vccBc93Wz4QaSDTMOd6lAcAP4 Subject: Documenting builtin methods To: python-list Content-Type: text/plain; charset=UTF-8 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373512579 news.xs4all.nl 15867 [2001:888:2000:d::a6]:42321 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50405 I have this innocent and simple code: from collections import deque exhaust_iter = deque(maxlen=0).extend exhaust_iter.__doc__ = "Exhaust an iterator efficiently without caching any of its yielded values." Obviously it does not work. Is there a way to get it to work simply and without creating a new scope (which would be a rather inefficient a way to set documentation, and would hamper introspection)? How about dropping the "simply" requirement?