Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7526

Re: dummy, underscore and unused local variables

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <philip@semanchuk.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'interpreter': 0.07; 'python': 0.08; '>>>>': 0.09; 'bool': 0.09; 'interpreter,': 0.09; 'nameerror:': 0.09; 'undefined.': 0.09; 'variables,': 0.09; '>>>': 0.12; 'am,': 0.14; 'wrote:': 0.14; 'defined': 0.14; 'dummy': 0.16; 'expression.': 0.16; 'list!': 0.16; 'received:mindspring.com': 0.16; 'underscore': 0.16; 'traceback': 0.16; '(most': 0.16; "'python": 0.19; "hasn't": 0.19; 'header:In-Reply-To:1': 0.21; 'last):': 0.23; 'asked': 0.24; 'expect': 0.25; 'object': 0.26; 'class': 0.29; 'google': 0.31; 'to:addr:python-list': 0.33; 'file': 0.34; 'however,': 0.34; '"",': 0.35; 'received:24': 0.35; 'charset:us-ascii': 0.36; 'case': 0.37; 'but': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'comments': 0.39; 'doing': 0.39; "i'd": 0.39; 'johnson': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'help': 0.40; 'results': 0.60; 'subject:, ': 0.60; 'hope': 0.60; 'your': 0.60; 'header:Message- Id:1': 0.62; 'note:': 0.63; 'ways,': 0.67; "google's": 0.69; '11:37': 0.84; 'punctuation.': 0.84; 'received:69.73': 0.84; 'subject:local': 0.84
Content-Type text/plain; charset=us-ascii
Mime-Version 1.0 (Apple Message framework v1084)
Subject Re: dummy, underscore and unused local variables
From Philip Semanchuk <philip@semanchuk.com>
In-Reply-To <20110613153702.GN2556@johnsons-web.com>
Date Mon, 13 Jun 2011 11:50:49 -0400
Content-Transfer-Encoding quoted-printable
References <20110613153702.GN2556@johnsons-web.com>
To Lista-Comp-Lang-Python list <python-list@python.org>
X-Mailer Apple Mail (2.1084)
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - deimos.nocdirect.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - semanchuk.com
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.178.1307980261.11593.python-list@python.org> (permalink)
Lines 51
NNTP-Posting-Host 82.94.164.166
X-Trace 1307980261 news.xs4all.nl 49042 [::ffff:82.94.164.166]:59468
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7526

Show key headers only | View raw


On Jun 13, 2011, at 11:37 AM, Tim Johnson wrote:

> NOTE: I see much on google regarding unused local variables, 
> however, doing a search for 'python _' hasn't proved fruitful.

Yes, Google's not good for searching punctuation. But 'python underscore dummy OR unused' might work better.

> On a related note: from the python interpreter if I do
>>>> help(_) 
> I get 
> Help on bool object:
> 
> class bool(int)
> |  bool(x) -> bool
> ......
> I'd welcome comments on this as well.
> 

In the Python interpreter, _ gives you the results of the last expression. When you first start the interpreter, _ is undefined.

$ python
>>> help(_)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name '_' is not defined
>>> True
True
>>> help(_)

Help on bool object:

class bool(int)
 |  bool(x) -> bool


In your case when you asked for help(_), the last object you used must have been a bool.

> 
> :) I expect to be edified is so many ways, some
> of them unexpected.

That's the nice thing about this list!

Hope this helps
Philip

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: dummy, underscore and unused local variables Philip Semanchuk <philip@semanchuk.com> - 2011-06-13 11:50 -0400

csiph-web