473,465 Members | 1,399 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

what's the deal of "_" in Python?

Can someone give me some pointers to the related docs? Thanks.

-Yun
Jul 18 '05 #1
4 1582
Yun Mao wrote:
Can someone give me some pointers to the related docs? Thanks.


It's a variable name. See http://docs.python.org/ref/identifiers.html

If you were hoping of a more elaborate answer, please refer to
http://groups.google.ca/groups?threa...0uni-berlin.de
and also give just a *little* more detail in your next question,
so we don't have to mindread about which use of "_" you are
talking about. It's used as a standalone variable name, as a
prefix in several different ways, sometimes as a substitute for
self, and so on. Which do you mean?

-Peter
Jul 18 '05 #2
phansen wrote:
Yun Mao wrote:
Can someone give me some pointers to the related docs? Thanks.

It's a variable name. See http://docs.python.org/ref/identifiers.html


....and is special in interactive mode. See
http://docs.python.org/ref/id-classes.html
Erik
Jul 18 '05 #3
The python interpreter understands "_" as a reference to the last value it
computed, exactly analogous to "%" in the maple interpreter if you're familiar
with that. I think it's also used as a (loop-) variable name with the
implication that the variable will never be referenced. (Personally I like to
use the name "anonymous" for that purpose.)
Jul 18 '05 #4
Erik Heneryd <er**@heneryd.com> wrote:
phansen wrote:
Yun Mao wrote:
Can someone give me some pointers to the related docs? Thanks.

It's a variable name. See http://docs.python.org/ref/identifiers.html


...and is special in interactive mode. See
http://docs.python.org/ref/id-classes.html


....and is used in the gettext module for internationalization (as a
function name, in that case).
Alex
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Moe A | last post by:
Hi, i need to list dependencies for my package & was wondering in what python release could you start making 'in <string>' calls with more than one char..eg: "JESUS" in bible instead of
6
by: Ken Varn | last post by:
Sometimes when I try to close my managed C++ application, the following dialog displays in Win 2000 Pro: The title of the dialog is "Server Busy". The message is "This action cannot be completed...
28
by: john_sips_tea | last post by:
Just tried Ruby over the past two days. I won't bore you with the reasons I didn't like it, however one thing really struck me about it that I think we (the Python community) can learn from. ...
5
by: Why Tea | last post by:
How do I find out what python modules are installed on a Solaris platform? I tried to import numarray, but python couldn't find it. /Why Tea
9
by: Dullme | last post by:
i can hardly know what is the code for this. I have researched palindromes, but unfortunately, I only have read about integers not for characters..I need some help..
7
by: Chris | last post by:
I have an database containing lots of numerical data. I want to write a browser based interface that will allow selection of various key parameters and yield tables, plots and/or printouts of the...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.