Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58940
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Subject | Re: my favorite line of py code so far |
| Date | 2013-11-09 14:49 +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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2296.1384004974.18130.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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