Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84701
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Subject | Re: Is there a more elegant way to spell this? |
| Date | 2015-01-28 12:29 +1100 |
| References | <mailman.18170.1422364524.18130.python-list@python.org> <54c8339f$0$13008$c3e8da3$5496439d@news.astraweb.com> <MPG.2f3257584e3201d69896af@nntp.aioe.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18197.1422408555.18130.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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