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


Groups > comp.lang.python > #58940

Re: my favorite line of py code so far

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '"this': 0.03; 'conventions': 0.07; 'subject:code': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'translation': 0.12; '"_"': 0.16; 'interpreter,': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'templates:': 0.16; 'underscore.': 0.16; 'applies': 0.16; 'wrote:': 0.18; 'stefan': 0.19; 'fit': 0.20; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; "doesn't": 0.30; 'calculated': 0.31; 'commonly': 0.31; 'context,': 0.31; 'class': 0.32; "we're": 0.32; 'quite': 0.32; 'skip:_ 10': 0.34; 'more,': 0.35; 'there': 0.35; 'example,': 0.37; 'e.g.': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'bill': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'back': 0.62; 'name': 0.63; 'obvious': 0.74; 'choices.': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: my favorite line of py code so far
Date Sat, 09 Nov 2013 14:49:39 +0100
Organization None
References <fbbabb45-f0e3-4e7f-968f-9822607c450a@googlegroups.com> <729e093a-6312-44dc-8ed4-1dd5ea344066@googlegroups.com> <l5l7fi$qi1$1@ger.gmane.org> <l5lah1$nru$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p5084bb2a.dip0.t-ipconnect.de
User-Agent KNode/4.7.3
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.2296.1384004974.18130.python-list@python.org> (permalink)
Lines 41
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1384004974 news.xs4all.nl 15867 [2001:888:2000:d::a6]:34904
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:58940

Show key headers only | View raw


Stefan Behnel wrote:

> Peter Otten, 09.11.2013 12:49:
>> There is no obvious meaning attached to _ -- so don't use it.
> 
> Not quite true. Depending on the context, the obvious meanings of "_" in
> Python are either
> 
> 1) "ignore me", e.g. in
> 
>     _, b = some_tuple
> 
> or
> 
> 2) "this is a non-public thing", as in
> 
>     class Xyz:
>         _private = 1
> 

This doesn't fit the bill provided we're discussing the name _ rather than 
any underscore.
> 
> 3) "I am the translation function", as commonly used in (HTML) templates:
> 
>     _("translation key here")
> 
> 
> None of the three meanings applies to the OP's example, AFAICT.

I can come up with one more, the last non-None result calculated in the 
interactive interpreter,

>>> 2*2
4
>>> _
4

so we're back to three. All seem to be established conventions rather than 
obvious choices.

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


Thread

my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-08 14:22 -0800
  Re: my favorite line of py code so far Chris Angelico <rosuav@gmail.com> - 2013-11-09 09:32 +1100
  Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-08 14:43 -0800
  Re: my favorite line of py code so far Peter Otten <__peter__@web.de> - 2013-11-09 08:12 +0100
  Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-09 01:23 -0800
    Re: my favorite line of py code so far Chris Angelico <rosuav@gmail.com> - 2013-11-09 20:28 +1100
    Re: my favorite line of py code so far Paul Rubin <no.email@nospam.invalid> - 2013-11-09 01:49 -0800
    Re: my favorite line of py code so far Peter Otten <__peter__@web.de> - 2013-11-09 12:49 +0100
    Re: my favorite line of py code so far Stefan Behnel <stefan_ml@behnel.de> - 2013-11-09 13:41 +0100
    Re: my favorite line of py code so far Chris Angelico <rosuav@gmail.com> - 2013-11-09 23:45 +1100
    Re: my favorite line of py code so far Peter Otten <__peter__@web.de> - 2013-11-09 14:49 +0100
  Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-10 00:57 -0800
    Re: my favorite line of py code so far Chris Angelico <rosuav@gmail.com> - 2013-11-10 21:23 +1100
  Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-10 00:59 -0800
  Re: my favorite line of py code so far Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-11-10 16:00 -0800

csiph-web