Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31627
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python.list@tim.thechases.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.007 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'diff': 0.05; 'line:': 0.07; 'trailing': 0.07; 'cc:addr:python-list': 0.10; ':-)': 0.13; '(usually)': 0.16; '-tkc': 0.16; 'alphabetical': 0.16; 'bouncing': 0.16; 'comma,': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message-id:@tim.thechases.com': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'wrote:': 0.17; 'skip:u 30': 0.17; 'tend': 0.17; 'either.': 0.22; 'cc:2**0': 0.23; 'changes,': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; "doesn't": 0.28; '>>>>': 0.29; 'usually': 0.30; 'towards': 0.32; 'cases,': 0.33; 'too.': 0.35; 'something': 0.35; 'but': 0.36; 'closing': 0.36; 'skip:m 40': 0.36; 'should': 0.36; 'too': 0.36; 'being': 0.37; 'item': 0.37; 'quite': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'skip:l 20': 0.38; 'little': 0.39; 'where': 0.40; 'subject:-': 0.40; 'easy': 0.60; 'letters': 0.62; 'email addr:gmail.com': 0.63; 'making': 0.64; 'matter.': 0.65; 'special': 0.73; 'lean': 0.84; 'paren': 0.84; 'received:50.22': 0.84; 'noise': 0.91 |
| Date | Thu, 18 Oct 2012 06:05:34 -0500 |
| From | Tim Chase <python.list@tim.thechases.com> |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16 |
| MIME-Version | 1.0 |
| To | wxjmfauth@gmail.com |
| Subject | Re: A desperate lunge for on-topic-ness |
| References | <mailman.2403.1350540402.27098.python-list@python.org> <507fa256$0$11093$c3e8da3@news.astraweb.com> <507fc6b4$0$6861$e4fe514c@news2.news.xs4all.nl> <bf646126-e170-4548-b0a1-de2e0444f71c@googlegroups.com> |
| In-Reply-To | <bf646126-e170-4548-b0a1-de2e0444f71c@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - boston.accountservergroup.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - tim.thechases.com |
| X-Source | |
| X-Source-Args | |
| X-Source-Dir | |
| Cc | python-list@python.org |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2424.1350558280.27098.python-list@python.org> (permalink) |
| Lines | 62 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1350558280 news.xs4all.nl 6842 [2001:888:2000:d::a6]:49590 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31627 |
Show key headers only | View raw
On 10/18/12 04:33, wxjmfauth@gmail.com wrote:
> I use a "double indentation".
>
>>>> if 'asdf' and 'asdf' and 'asdf' \
> ... 'asdf' and 'asdf' and \
> ... 'asdf' and 'asdf':
> ... print('do if')
> ... s = 'asdf'
> ... ss = 'asdf'
> ...
> do if
>>>> if looks_like_it_might_be_spam(
> ... some_longer_variables,
> ... here_and_here, and_here_also):
> ... logger.notice("might be spam")
> ... move_to_spam_folder(some_longer_variables)
> ... update_spam_statistics(here_and_here)
I lean towards double-indent as well, though I favor parens/brackets
vs. trailing backslashes. My conditions usually go one-per-line,
too. I also tend to put my closing paren+colon on a stand-alone line:
if (
something
or something_else
or yet_other_stuff
):
do_thing1()
do_thing2()
It's not quite as nice with pure parens, working better with
function-calls. However, it makes my git/svn diffs easier to read
when conditions get added/removed because only that line (usually)
changes, rather than having the noise of the paren moving around.
In 2.5 and later, I like to write that as
if any([
something,
something_else,
yet_other_stuff,
]):
do_thing1()
do_thing2()
where each item is uniform (one trailing comma, rather than one item
being special without a comma/or/and) so I don't have the diff noise
for "or"/"and" bouncing around either.
Making my diffs easy to read is pretty important to me.
-tkc
PS: and in such cases, yes, I often alphabetize my conditions too as
long as the order doesn't matter. Just a little CDO. That's OCD,
but in alphabetical order the way the letters should be :-)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
A desperate lunge for on-topic-ness Zero Piraeus <schesis@gmail.com> - 2012-10-18 02:06 -0400
Re: A desperate lunge for on-topic-ness Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-18 06:31 +0000
Re: A desperate lunge for on-topic-ness Hans Mulder <hansmu@xs4all.nl> - 2012-10-18 11:07 +0200
Re: A desperate lunge for on-topic-ness wxjmfauth@gmail.com - 2012-10-18 02:33 -0700
Re: A desperate lunge for on-topic-ness Tim Chase <python.list@tim.thechases.com> - 2012-10-18 06:05 -0500
Re: A desperate lunge for on-topic-ness Chris Angelico <rosuav@gmail.com> - 2012-10-18 21:01 +1100
RE: A desperate lunge for on-topic-ness "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-10-18 18:42 +0000
Re: A desperate lunge for on-topic-ness Ben Finney <ben+python@benfinney.id.au> - 2012-10-19 11:33 +1100
Re: A desperate lunge for on-topic-ness rusi <rustompmody@gmail.com> - 2012-10-18 20:35 -0700
Re: A desperate lunge for on-topic-ness Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-19 04:08 +0000
Re: A desperate lunge for on-topic-ness Zero Piraeus <schesis@gmail.com> - 2012-10-18 06:31 -0400
Re: A desperate lunge for on-topic-ness rusi <rustompmody@gmail.com> - 2012-10-17 23:55 -0700
Re: A desperate lunge for on-topic-ness Paul Rubin <no.email@nospam.invalid> - 2012-10-17 23:56 -0700
Re: A desperate lunge for on-topic-ness Grant Edwards <invalid@invalid.invalid> - 2012-10-18 13:16 +0000
Re: A desperate lunge for on-topic-ness Ben Finney <ben+python@benfinney.id.au> - 2012-10-19 11:39 +1100
Re: A desperate lunge for on-topic-ness Den <patentsvnc@gmail.com> - 2012-10-18 08:55 -0700
Re: A desperate lunge for on-topic-ness Neil Cerutti <neilc@norwich.edu> - 2012-10-18 16:13 +0000
Re: A desperate lunge for on-topic-ness Chris Angelico <rosuav@gmail.com> - 2012-10-19 03:21 +1100
RE: A desperate lunge for on-topic-ness "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-10-18 18:51 +0000
RE: A desperate lunge for on-topic-ness "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-10-18 18:50 +0000
Re: A desperate lunge for on-topic-ness Zero Piraeus <schesis@gmail.com> - 2012-10-18 17:36 -0400
Re: A desperate lunge for on-topic-ness Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-19 01:50 +0000
Re: A desperate lunge for on-topic-ness Den <patentsvnc@gmail.com> - 2012-10-18 08:55 -0700
Re: A desperate lunge for on-topic-ness Grant Edwards <invalid@invalid.invalid> - 2012-10-18 17:44 +0000
Re: A desperate lunge for on-topic-ness Gene Heskett <gheskett@wdtv.com> - 2012-10-18 18:53 -0400
Re: A desperate lunge for on-topic-ness Krzysztof Voss <shobbo@gmail.com> - 2012-10-19 15:16 -0700
Re: A desperate lunge for on-topic-ness Krzysztof Voss <shobbo@gmail.com> - 2012-10-19 15:16 -0700
csiph-web