Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'interpreter': 0.07; 'python': 0.08; '>>>>': 0.09; 'bool': 0.09; '>>>': 0.12; 'am,': 0.14; 'received:209.85.214.174': 0.14; 'received:mail- iw0-f174.google.com': 0.14; 'result.': 0.14; 'wrote:': 0.14; '10}': 0.16; 'angelico': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'tue,': 0.17; 'otherwise,': 0.19; 'header:In-Reply-To:1': 0.21; 'there.': 0.25; 'message- id:@mail.gmail.com': 0.28; 'received:209.85.214': 0.28; 'class': 0.29; 'to:addr:python-list': 0.33; 'chris': 0.34; 'quite': 0.36; 'received:google.com': 0.37; 'something': 0.37; 'received:209.85': 0.37; 'subject:: ': 0.38; 'comments': 0.39; 'skip:s 20': 0.39; 'received:209': 0.39; 'johnson': 0.39; 'to:addr:python.org': 0.39; 'help': 0.40; 'subject:, ': 0.60; 'your': 0.60; 'note:': 0.63; 'special': 0.66; '1+2': 0.84; 'subject:local': 0.84; 'presumably': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=PsR2uUSM9b/wniSDDbtdNPB3fQ1iNq2uBoRQ0fUZw0o=; b=kij/IubN9R8nM2HEKLjJbLe2jqtu962hFYSAYcpI+Jb64++OwFosbMEyVs3oUY2enX ah0Sk+zpr3p0BcuFhX+iIB3GTaIbvSx9IbmqFYEomBj6m82WG8s22B1KlcwABML4Pklk aWamGMpbHVoXIJ7QLRbgc6UGaHV77KyLH01rM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=nZxA8qLd9Vl7FzrvnsFpWT7WIGqCquJEDoaCy246ayqIoWOIMSQscsGmmxj2v0kQ7t nJHwOXIxqb2QUV+mXP4ZueFY0nw9FXQ6i18ejs0WDnzxydOZn2f5+8/v7VoKHVz4WSUF Ea/OgGXWidQNtC9W0YRRRTpvG+x9RIxiHt9W8= MIME-Version: 1.0 In-Reply-To: <20110613153702.GN2556@johnsons-web.com> References: <20110613153702.GN2556@johnsons-web.com> Date: Tue, 14 Jun 2011 01:55:04 +1000 Subject: Re: dummy, underscore and unused local variables From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 30 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1307980528 news.xs4all.nl 49176 [::ffff:82.94.164.166]:48415 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7527 On Tue, Jun 14, 2011 at 1:37 AM, Tim Johnson wrote: > On a related note: from the python interpreter if I do >>>> help(_) > I get > Help on bool object: > > class bool(int) > =A0| =A0bool(x) -> bool > =A0...... > =A0I'd welcome comments on this as well. _ is special to IDLE. >>> 1+2 3 >>> _ 3 It's the last result. So presumably when you did it, your last result was something boolean. >>> sorted([random.randint(1,10) for i in range(10)]) [1, 1, 2, 3, 4, 4, 5, 7, 8, 10] >>> set(_) {1, 2, 3, 4, 5, 7, 8, 10} Can be quite handy, if you remember it's there. Otherwise, not so much. :) Chris Angelico