Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42766

Re: In defence of 80-char lines

References <515cd919$0$29966$c3e8da3$5496439d@news.astraweb.com> <c338b844-e9ce-46a7-9daf-20374372390e@googlegroups.com> <kjj7bk$22k$1@ger.gmane.org> <20130404060913.2e771293@bigbox.christie.dr>
From Joshua Landau <joshua.landau.ws@gmail.com>
Date 2013-04-04 18:18 +0100
Subject Re: In defence of 80-char lines
Newsgroups comp.lang.python
Message-ID <mailman.109.1365095929.3114.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On 4 April 2013 12:09, Tim Chase <python.list@tim.thechases.com> wrote:

> On 2013-04-04 08:43, Peter Otten wrote:
> > llanitedave wrote:
> >> self.mainLabel.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD,
> faceName = "FreeSans"))
> >
> > I think I would prefer
> >
> > labelfont = wx.Font(
> >     pointSize=12,
> >     style=wx.DEFAULT,
> >     family=wx.NORMAL,
> >     weight=wx.BOLD,
> >     faceName="FreeSans")
> > self.mainLabel.SetFont(labelfont)
>
> +1
> The only change I'd make to this suggestion would be to add a
> semi-superfluous comma+newline after the last keyword argument too:
>
>  labelfont = wx.Font(
>      pointSize=12,
>      style=wx.DEFAULT,
>      family=wx.NORMAL,
>      weight=wx.BOLD,
>      faceName="FreeSans",
>      )
>

Since we're all showing opinions, I've always prefered the typical block
indentation:

labelfont = wx.Font(
    pointSize=12,
    style=wx.DEFAULT,
    family=wx.NORMAL,
    weight=wx.BOLD,
    faceName="FreeSans",
) # Not indented here

as

A(
    B(
        C,
        D,
        E,
    )
)

reads a lot cleaner than

A(
    B(
        C,
        D,
        E
        )
    )

which makes diffs cleaner when you need to insert something after
> faceName:
>
<DIFS SNIP>

That is a very good point :).

Additionally, if there are lots of keyword parameters like this, I'd
> be tempted to keep them in sorted order for ease of tracking them
> down (though CSS has long-standing arguments on how properties should
> be ordered, so to each their own on this).
>

Personally I'd rarely be tempted to put more than 9 or so arguments
directly into a function or class. Most of the time I can imagine unpacking
(or equiv.) would look much more readable in the circumstances that apply.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

In defence of 80-char lines Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-04 01:36 +0000
  Re: In defence of 80-char lines Andrew Berg <bahamutzero8825@gmail.com> - 2013-04-03 20:59 -0500
  Re: In defence of 80-char lines Mitya Sirenef <msirenef@lightbird.net> - 2013-04-03 22:40 -0400
  Re: In defence of 80-char lines llanitedave <llanitedave@veawb.coop> - 2013-04-03 21:32 -0700
    Re: In defence of 80-char lines Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-04 06:33 +0000
    Re: In defence of 80-char lines gregor <gregor@ediwo.com> - 2013-04-04 08:40 +0200
    Re: In defence of 80-char lines Peter Otten <__peter__@web.de> - 2013-04-04 08:43 +0200
    Re: In defence of 80-char lines Tim Chase <python.list@tim.thechases.com> - 2013-04-04 06:09 -0500
    Re: In defence of 80-char lines Roy Smith <roy@panix.com> - 2013-04-04 07:52 -0400
      Re: In defence of 80-char lines llanitedave <llanitedave@veawb.coop> - 2013-04-04 08:28 -0700
    Re: In defence of 80-char lines Jason Swails <jason.swails@gmail.com> - 2013-04-04 08:18 -0400
    Re: In defence of 80-char lines Joshua Landau <joshua.landau.ws@gmail.com> - 2013-04-04 18:18 +0100
    Re: In defence of 80-char lines Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-04-04 18:22 -0400
  Re: In defence of 80-char lines rusi <rustompmody@gmail.com> - 2013-04-03 21:56 -0700
  Re: In defence of 80-char lines Rui Maciel <rui.maciel@gmail.com> - 2013-04-04 08:15 +0100
  Re: In defence of 80-char lines Jason Swails <jason.swails@gmail.com> - 2013-04-04 08:13 -0400
    Re: In defence of 80-char lines Roy Smith <roy@panix.com> - 2013-04-04 08:39 -0400
      Re: In defence of 80-char lines Jason Swails <jason.swails@gmail.com> - 2013-04-04 09:23 -0400
      Re: In defence of 80-char lines Neil Cerutti <neilc@norwich.edu> - 2013-04-04 15:56 +0000
      Re: In defence of 80-char lines Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2013-04-04 23:04 +0530
        Re: In defence of 80-char lines Roy Smith <roy@panix.com> - 2013-04-04 19:55 -0400
  Re: In defence of 80-char lines Mitya Sirenef <msirenef@lightbird.net> - 2013-04-04 12:12 -0400
  Re: In defence of 80-char lines jmfauth <wxjmfauth@gmail.com> - 2013-04-04 13:28 -0700
    Re: In defence of 80-char lines Jason Swails <jason.swails@gmail.com> - 2013-04-04 17:00 -0400
    Re: In defence of 80-char lines Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-05 00:14 +0000

csiph-web