Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42729
| Date | 2013-04-03 22:40 -0400 |
|---|---|
| From | Mitya Sirenef <msirenef@lightbird.net> |
| Subject | Re: In defence of 80-char lines |
| References | <515cd919$0$29966$c3e8da3$5496439d@news.astraweb.com> <515CDE6D.3000502@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.86.1365043256.3114.python-list@python.org> (permalink) |
On 04/03/2013 09:59 PM, Andrew Berg wrote: > While I agree that not having a line take up hundreds of characters is a > good thing, 80 is really arbitrary in 2013 and having any self-imposed > hard limit is silly. When you put a single 4- or 5-character word on a > new line because you don't want to go over 80 (or 120 or whatever), the > code is /less/ readable. A better guideline is to make new lines as > necessary to make things more readable rather than blindly stick to some > hard limit and say it's more readable just because. > > Also, IMO, 80 is far too limiting and I find 120-130 much better. Then > again, I like small font sizes and avoid lower resolution screens like > the plague. I have to agree. To some degree, it's a matter of taste: for me, 80c limit looks ugly to the extreme, at least in Django; but 140+ looks even uglier, and the longer line is, the uglier it looks. The optimal size for Django code is a 105 char soft limit -- by soft limit I mean that under 105 it's always one line, 105-110 I decide on a case-by-case basis and over 110 is always split. So my preference is: 105 > 120-130 > 140 > 80 > 140+ The trade-off is that on one hand, the code is more readable when a single line is a single "operation", from a cognitive standpoint, when you're thinking about the logic of the function as a whole, or a subset of a function if it's too long (which it shouldn't be, right?) On the other hand, even if your monitor is wide, you probably still want to fit in the browser window and the terminal window, and as the blog author rightly notes, really long lines do get harder to read. Again, I mostly work with Django and I suspect if I worked in regular Python I would possibly gravitate towards 95-100 limit. I find the blog author's point about fitting more text nonsensical: you can obviously fit more text PER LINE if lines are longer! And you can quite easily fit two 120-130 wide gvim screens on a modern monitor with room to spare. I'm sure eyesight acuity also figures into this: I prefer to work without glasses -- otherwise my eyes get tired after a couple of hours; but this means I can't see code on my second monitor. If I could, I might have preferred having browser and terminal on one monitor and Gvim with slightly longer width limits than I use now. -m -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ The Bible is literature, not dogma. George Santayana
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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