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


Groups > comp.lang.python > #84701

Re: Is there a more elegant way to spell this?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.81.MISMATCH!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.062
X-Spam-Evidence '*H*': 0.88; '*S*': 0.00; '*is*': 0.09; 'facts': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'underscore': 0.09; 'finney': 0.16; 'henry': 0.16; 'link,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'says...': 0.16; 'variable': 0.18; 'header:User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'correct': 0.29; "doesn't": 0.30; 'commonly': 0.31; 'steven': 0.31; 'writes:': 0.31; 'themselves': 0.32; 'common': 0.35; 'but': 0.35; 'subject:?': 0.36; 'url:org': 0.36; 'two': 0.37; '(3)': 0.38; 'ben': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'according': 0.40; 'challenge': 0.61; 'name:': 0.61; 'name': 0.63; 'subject:more': 0.64; 'more': 0.64; 'teach': 0.65; 'subject:there': 0.68; 'fact,': 0.69; 'business': 0.70; 'article': 0.77; 'subject:this': 0.83; 'received:125': 0.84; 'usage.': 0.84; 'url:latest': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject Re: Is there a more elegant way to spell this?
Date Wed, 28 Jan 2015 12:29:18 +1100
References <mailman.18170.1422364524.18130.python-list@python.org> <54c8339f$0$13008$c3e8da3$5496439d@news.astraweb.com> <MPG.2f3257584e3201d69896af@nntp.aioe.org>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock sha1:+ntQY/p1CbqBEkB499WTprh8YZk=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18197.1422408555.18130.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1422408555 news.xs4all.nl 2978 [2001:888:2000:d::a6]:40008
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:84701

Show key headers only | View raw


Mario Figueiredo <marfig@gmail.com> writes:

> In article <54c8339f$0$13008$c3e8da3$5496439d@news.astraweb.com>, 
> steve+comp.lang.python@pearwood.info says...
> > (3) _ is also commonly used as a "don't care" variable name:
> > 
> > a, _, b, _ = get_four_items()  # but I only care about two of them
> > 
>
> According to the following link, it is actually a double underscore:
> http://docs.python-guide.org/en/latest/writing/style/#idioms

More accurately (and as acknowledged in that guide), a single underscore
*is* a common name for a “don't care” name, but is better avoided for
that purpose because it's also commonly used for other purposes.

In other words: That guide is correct in its admonition, but that
doesn't challenge what Steven said about common usage.

-- 
 \       “My business is to teach my aspirations to conform themselves |
  `\              to fact, not to try and make facts harmonise with my |
_o__)                   aspirations.“ —Thomas Henry Huxley, 1860-09-23 |
Ben Finney

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


Thread

Is there a more elegant way to spell this? Neal Becker <ndbecker2@gmail.com> - 2015-01-27 08:15 -0500
  Re: Is there a more elegant way to spell this? Rustom Mody <rustompmody@gmail.com> - 2015-01-27 06:08 -0800
  Re: Is there a more elegant way to spell this? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-01-27 16:25 +0200
    Re: Is there a more elegant way to spell this? Neal Becker <ndbecker2@gmail.com> - 2015-01-27 09:37 -0500
      Re: Is there a more elegant way to spell this? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-01-27 16:47 +0200
    Re: Is there a more elegant way to spell this? Mario Figueiredo <marfig@gmail.com> - 2015-01-27 19:05 +0100
      Re: Is there a more elegant way to spell this? random832@fastmail.us - 2015-01-27 13:13 -0500
    Re: Is there a more elegant way to spell this? Neal Becker <ndbecker2@gmail.com> - 2015-01-27 13:25 -0500
  Re: Is there a more elegant way to spell this? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 11:55 +1100
    Re: Is there a more elegant way to spell this? Mario Figueiredo <marfig@gmail.com> - 2015-01-28 02:19 +0100
      Re: Is there a more elegant way to spell this? Ben Finney <ben+python@benfinney.id.au> - 2015-01-28 12:29 +1100
        Re: Is there a more elegant way to spell this? Mario Figueiredo <marfig@gmail.com> - 2015-01-28 09:32 +0100
      Re: Is there a more elegant way to spell this? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-28 13:16 +1100

csiph-web