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: 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: <729e093a-6312-44dc-8ed4-1dd5ea344066@googlegroups.com> 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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.