From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19052 invoked by alias); 8 Oct 2010 21:20:05 -0000 Received: (qmail 19039 invoked by uid 22791); 8 Oct 2010 21:20:03 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Oct 2010 21:19:53 +0000 Received: from kpbe19.cbf.corp.google.com (kpbe19.cbf.corp.google.com [172.25.105.83]) by smtp-out.google.com with ESMTP id o98LJoLE005678 for ; Fri, 8 Oct 2010 14:19:50 -0700 Received: from vws18 (vws18.prod.google.com [10.241.21.146]) by kpbe19.cbf.corp.google.com with ESMTP id o98LJFw6000998 for ; Fri, 8 Oct 2010 14:19:49 -0700 Received: by vws18 with SMTP id 18so242904vws.2 for ; Fri, 08 Oct 2010 14:19:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.175.199 with SMTP id bb7mr864433vcb.3.1286572788786; Fri, 08 Oct 2010 14:19:48 -0700 (PDT) Received: by 10.220.118.2 with HTTP; Fri, 8 Oct 2010 14:19:48 -0700 (PDT) In-Reply-To: References: Date: Fri, 08 Oct 2010 21:20:00 -0000 Message-ID: Subject: Re: Python coding style From: Doug Evans To: Tom Tromey Cc: Joel Brobecker , gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-10/txt/msg00160.txt.bz2 On Wed, Oct 6, 2010 at 3:25 PM, Tom Tromey wrote: > Doug> Can we, at least as a first pass, adopt this? > Doug> http://google-styleguide.googlecode.com/svn/trunk/pyguide.html > > It is ok with me. =A0I read through it and I thought it seemed reasonable > enough. > > Can you say how it compares to PEP 8? > > =A0 =A0http://www.python.org/dev/peps/pep-0008/ > > They seemed basically compatible to me, but I only spent a few minutes > with each. AIUI there are a few incompatibilities. e.g. pep says importing functions is ok, google style guide says only import packages/modules. I'm by no means an expert. I think Google's guide specifies more, and specifies the reasons more. We *could* reference both, and a blanket statement that X wins when there's a conflict. And then provide a supplement for gdb-specifics. Easier than writing our own from scratch. > Since you are more familiar with it, would you mind doing a little extra > review for changes to .py files for a while? =A0Some of the rules are > different enough from GNU C that it will take some getting used to; > e.g., the hanging indentation rule. If you wish. > A couple specific exceptions: > > * We shouldn't use the #!/usr/bin/env thing For my own education, why not? [So I can document it in the style guide.] > * We should use FIXME instead of TODO, as the former is already gdb > =A0practice Yeah. > Phil> My deeply biased and very personal ideology her e is if how emacs > Phil> handles it. > > The defaults are mostly ok. =A0You'll need to set indent-tabs-mode to nil > in these buffers (though even this happens automatically with the > default settings). We should provide an emacs py mode that specifies our style.