In defence of 80-char lines

Jason Swails jason.swails at gmail.com
Thu Apr 4 08:18:37 EDT 2013


On Thu, Apr 4, 2013 at 7:09 AM, Tim Chase <python.list at 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",
>      )
>
> which makes diffs cleaner when you need to insert something after
> faceName:
>
> --- peter1.txt  2013-04-04 06:03:01.420762566 -0500
> +++ peter2.txt  2013-04-04 06:03:34.736762582 -0500
> @@ -3,4 +3,5 @@
>      style=wx.DEFAULT,
>      family=wx.NORMAL,
>      weight=wx.BOLD,
> -    faceName="FreeSans")
> +    faceName="FreeSans",
> +    otherValue=42)
>
> vs.
>
> --- tkc1.txt    2013-04-04 06:02:52.436762562 -0500
> +++ tkc2.txt    2013-04-04 06:03:51.392762588 -0500
> @@ -4,4 +4,5 @@
>      family=wx.NORMAL,
>      weight=wx.BOLD,
>      faceName="FreeSans",
> +    otherValue=42,
>      )
>

+1

I wasn't aware you could do this (superfluous trailing commas), although I
admit it hadn't occurred to me to try.  I use git for virtually everything,
and I regularly parse diffstats -- this would make them much easier to
grok.  (It's an incredibly helpful bug-tracking technique)

Thanks!
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130404/3521b45d/attachment.html>


More information about the Python-list mailing list