Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news2.euro.net!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'mrab': 0.05; 'c++,': 0.07; 'python': 0.09; 'cc:addr:python-list': 0.10; ':-)': 0.13; 'parentheses': 0.16; 'roy': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'feb': 0.19; 'email addr:gmail.com>': 0.20; 'java': 0.21; 'cc:2**0': 0.23; '>': 0.23; 'needed.': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'skip:& 60': 0.27; 'message-id:@mail.gmail.com': 0.27; 'chris': 0.28; 'indentation': 0.29; 'multiline': 0.29; 'stuff': 0.30; 'could': 0.32; 'goes': 0.33; 'languages': 0.33; 'received:google.com': 0.34; 'skip:l 30': 0.35; 'but': 0.36; 'visual': 0.36; "didn't": 0.36; 'should': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'skip:l 20': 0.38; 'some': 0.38; 'where': 0.40; 'smith': 0.71; 'article': 0.78; '2013': 0.84; 'conditions,': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=XjPzbNLJk71u7Kw3GhxQw/EvU6P7IrvZ0pmpDJK8J00=; b=gqul5tB24DAZ75AxAENRF/SKWpSyBXaKMgJ0HMKAcf5S9j8ZOw4usegtdpbjsXwpVg MbkDa5x7SrYGhVADDcv1zFKLshsVFikxrUQVwHJ3pZZxPunDJIulAtEQFs9YzRhrIYR2 KMjNWq5lV0PcT2hZkKikrKHvtsx1B70q7X5y0Nb0svQin3CEvbxChY231IFbPmh0aQcu vbVNgvbIFCFfP1HbW/rhUX0ZRDoFDbtqnPIbuV1cKQyT83/s+a9lhGl2zdc529bs442d rW+KnF08OV8zPY70ui6zda81RWyys59EEH1C0BtPIPTkOSALWmuUROYR8GwhznWqTqyG Jmrw== X-Received: by 10.112.14.14 with SMTP id l14mr3591027lbc.110.1361743156216; Sun, 24 Feb 2013 13:59:16 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <5127848B.1060004@gmail.com> <928d2cf7-728b-4f35-b8c9-4c9b958507e5@googlegroups.com> <61471a01-ee6e-4bc6-bd08-8696a31ec1eb@googlegroups.com> <512A796D.6070802@mrabarnett.plus.com> From: Joshua Landau Date: Sun, 24 Feb 2013 21:58:36 +0000 Subject: Re: Python Newbie To: Roy Smith Content-Type: multipart/alternative; boundary=f46d0401fe911a030904d67f89ef Cc: python-list 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: 156 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361743157 news.xs4all.nl 6931 [2001:888:2000:d::a6]:48780 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39802 --f46d0401fe911a030904d67f89ef Content-Type: text/plain; charset=ISO-8859-1 On 24 February 2013 20:48, Roy Smith wrote: > In article , > Chris Angelico wrote: > > > On Mon, Feb 25, 2013 at 7:34 AM, MRAB > wrote: > > > Some languages require parentheses, others don't. > > > > > > C does. C++, Java and C# are descended from, or influenced by, C. > > > > > > Algol didn't (doesn't?). Pascal, Modula-2, Oberon, Ada, and others > > > don't. > > > > > > Parentheses are used where required, but not used where they're not > > > required, in order to reduce visual clutter. > > > > And just to muddy the waters, parens are used in Python when the > > condition goes over a line break: > > > > if (condition1 > > and condition2 > > and condition3): > > > > ChrisA > > That could also be written: > > if condition1 \ > and condition2 \ > and condition3: > > but as a practical matter, I would write it in the parens style, if for > no other reason than because emacs does a better job of auto-indenting > it that way :-) > Pah, condition1 = long_condition_expression_1 condition2 = long_condition_expression_2 condition3 = long_condition_expression_3 if condition1 and condition2 and condition3: STUFF No multiline needed. If you have *many* conditions, then: supercondition = all( condition1, condition2, condition3, condition4, condition5, condition6, condition7, condition8, condition9 ) # or equiv. if supercondition: STUFF Reason: Indentation should be *really simple*. --f46d0401fe911a030904d67f89ef Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 24 February 2013 20:48, Roy Smith <= ;roy@panix.com> wrote:
In article <mailman.2434.1361738581.2939.python-list@pytho= n.org>,
=A0Chris Angelico <rosuav@gmail.com> wrote:

> On Mon, Feb 25, 2013 at 7:34 AM, MRAB <python@mrabarnett.plus.com> wrot= e:
> > Some languages require parentheses, others don't.
> >
> > C does. C++, Java and C# are descended from, or influenced by, C.=
> >
> > Algol didn't (doesn't?). Pascal, Modula-2, Oberon, Ada, a= nd others
> > don't.
> >
> > Parentheses are used where required, but not used where they'= re not
> > required, in order to reduce visual clutter.
>
> And just to muddy the waters, parens are used in Python when the
> condition goes over a line break:
>
> if (condition1
> =A0 =A0 and condition2
> =A0 =A0 and condition3):
>
> ChrisA

That could also be written:

if condition1 \
=A0 =A0and condition2 \
=A0 =A0and condition3:

but as a practical matter, I would write it in the parens style, if for
no other reason than because emacs does a better job of auto-indenting
it that way :-)

P= ah,

co= ndition1 =3D long_condition_expression_1
condition2 =3D long_condition_expression_2
= condition3 =3D long_condition_expression_3

if condition1 and condition2 and c= ondition3:
=A0 =A0 STUFF
No multiline needed. If you have *many* = conditions, then:

supercondition =3D all(
=A0 =A0 condition1,
=A0 =A0 condition2,
=A0 =A0 condition3,
=A0 =A0 cond= ition4,
=A0 =A0 condition5,
=A0 =A0 condition6,
=
=A0 =A0 condition7,
=A0 =A0 cond= ition8,
=A0 =A0 condition9
=
) # or equiv.

if supercondition:
=A0 =A0 STUFF


Reason:
Indentation should be *really simple*.
--f46d0401fe911a030904d67f89ef--