Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'that?': 0.05; 'string': 0.09; 'literal': 0.09; 'raises': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'any.': 0.16; 'caching': 0.16; "can't.": 0.16; 'collections': 0.16; 'deque': 0.16; 'expecting': 0.16; 'finney': 0.16; 'iterator': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'surprising': 0.16; '(you': 0.16; 'obviously': 0.18; 'import': 0.22; 'header:User-Agent:1': 0.23; 'right.': 0.26; 'post': 0.26; 'code:': 0.26; 'header:X -Complaints-To:1': 0.27; "doesn't": 0.30; 'along': 0.30; 'work.': 0.31; 'code': 0.31; 'writes:': 0.31; 'linux': 0.33; 'guess': 0.33; 'actual': 0.34; 'skip:d 20': 0.34; "can't": 0.35; 'there': 0.35; 'ben': 0.38; 'to:addr:python-list': 0.38; 'expect': 0.39; 'explain': 0.39; 'does': 0.39; 'heard': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'how': 0.40; 'then,': 0.60; 'simply': 0.61; 'simple': 0.61; "you're": 0.61; "you've": 0.63; 'show': 0.63; 'demonstrates': 0.84; 'different.': 0.84; 'observed': 0.84; 'yielded': 0.84; 'besides,': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: Documenting builtin methods Date: Thu, 11 Jul 2013 13:57:06 +1000 References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: rasputin.madmonks.org X-Public-Key-ID: 0xBD41714B X-Public-Key-Fingerprint: 9CFE 12B0 791A 4267 887F 520C B7AC 2E51 BD41 714B X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-gpg.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:Q7y6EvAELbwbMJr/8d8FkJMCuCE= 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: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373515042 news.xs4all.nl 15894 [2001:888:2000:d::a6]:55253 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50407 Joshua Landau writes: > 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. Right. It raises a SyntaxError because you've got a simple string literal that isn't closed before the end of the line. > Is there a way to get it to work simply What behaviour would you expect from that? We can't guess what you mean by “get it to work” unless we know what you're expecting and how the observed behaviour is different. A good way to do this would be to show some actual code that demonstrates the surprising behaviour (you may need to post using a service that doesn't munge your text), along with the traceback if any. Then, show a session that behaves the way you'd expect it to behave, and we can explain either how to achieve that or why it can't. -- \ Q: “I've heard that Linux causes cancer...” Torvalds: “That's a | `\ filthy lie. Besides, it was only in rats and has not been | _o__) reproduced in humans.” —Linus Torvalds | Ben Finney