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


Groups > comp.lang.python > #7526 > unrolled thread

Re: dummy, underscore and unused local variables

Started byPhilip Semanchuk <philip@semanchuk.com>
First post2011-06-13 11:50 -0400
Last post2011-06-13 11:50 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#7526 — Re: dummy, underscore and unused local variables

FromPhilip Semanchuk <philip@semanchuk.com>
Date2011-06-13 11:50 -0400
SubjectRe: dummy, underscore and unused local variables
Message-ID<mailman.178.1307980261.11593.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web