Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: A desperate lunge for on-topic-ness

Reply
Thread Tools

Re: A desperate lunge for on-topic-ness

 
 
Jean-Michel Pichavant
Guest
Posts: n/a
 
      10-19-2012


----- Original Message -----
[snipe 80 char line discussion]
> And, quite frankly, people who care more about the readability of
> their
> code than about squeezing in as much processing into a single line of
> text as possible.
>


As usual Steven, you take someone's argument, you add a little bit of exaggeration and make it sound silly.
Using 80+ char lines doesn't mean I put all my efforts exceeding the 80 char limit. As a matter of fact, I never
get the char limit get into the way of readability. What needs to be short will be short, and what needs to be long will be long.


[snip]
> Flame away


good job )

JM
 
Reply With Quote
 
 
 
 
Steven D'Aprano
Guest
Posts: n/a
 
      10-19-2012
On Fri, 19 Oct 2012 11:21:06 +0200, Jean-Michel Pichavant wrote:

> Using 80+ char lines doesn't mean
> I put all my efforts exceeding the 80 char limit.


I didn't say it did. I was describing some of the reasons people might
choose to stick to the 79 character limit, beyond the reason you gave,
which quite frankly is the least important reason. 80 character
terminals? Who still uses them? Well, a few people, but they're in a
minority. But caring about the readability of code? Everyone needs to
read code at some point, and 79 characters is a good balance between
stuffing too much into a single line and spreading it out too thinly over
multiple lines.


> As a matter of fact, I
> never get the char limit get into the way of readability. What needs to
> be short will be short, and what needs to be long will be long.


Code never *needs* to be long, because it can always be shortened.

Some code might be more conveniently written as a single long line. But I
would argue that nearly never is code more easily *read* as a single long
line, and since code is read much more than it is written, it is more
important to optimise for reading, not writing.



--
Steven
 
Reply With Quote
 
 
 
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      10-20-2012
On 19 Oct 2012 22:14:27 GMT, Steven D'Aprano
<(E-Mail Removed)> declaimed the following in
gmane.comp.python.general:


> I didn't say it did. I was describing some of the reasons people might
> choose to stick to the 79 character limit, beyond the reason you gave,
> which quite frankly is the least important reason. 80 character
> terminals? Who still uses them? Well, a few people, but they're in a
> minority. But caring about the readability of code? Everyone needs to
> read code at some point, and 79 characters is a good balance between
> stuffing too much into a single line and spreading it out too thinly over
> multiple lines.
>


Strangely, we've gone from 80-character fixed width displays to
who-knows-what (if I drop my font size I can probably get nearly 200
characters across in full-screen mode)...

But at the same time we've gone from 132-character line-printers
using fan-fold 11x17 pages, to office inkjet/laser printers using 8.5x11
paper, defaulting to portrait orientation -- with a 10 character/inch
font, and 1/4" left/right margins, we're back to 80 character limitation
<G>
--
Wulfraed Dennis Lee Bieber AF6VN
http://www.velocityreviews.com/forums/(E-Mail Removed) HTTP://wlfraed.home.netcom.com/

 
Reply With Quote
 
Tim Chase
Guest
Posts: n/a
 
      10-20-2012
On 10/19/12 17:14, Steven D'Aprano wrote:
> Code never *needs* to be long, because it can always be shortened.


I advocate one bit per line:

1
0
1
0
0
1
0
1
1
0
0
1
0
1
1
1
0
0
0
0
1
1
1
0
1
1
0
0
1
1
0
1
1
0
0
1
1
1
1
0
0
1
1
1
1
1
1
1

Ā«grins, ducks, and fleesĀ»

Shortenedly-yers,

-tkc

 
Reply With Quote
 
rusi
Guest
Posts: n/a
 
      10-20-2012
On Oct 20, 8:27*am, Tim Chase <(E-Mail Removed)> wrote:
> On 10/19/12 17:14, Steven D'Aprano wrote:
>
> > Code never *needs* to be long, because it can always be shortened.

>
> I advocate one bit per line:
>
> 1
> 0
> 1
> 0
> 0
> 1
> 0
> 1
> 1
> 0
> 0
> 1
> 0
> 1
> 1
> 1
> 0
> 0
> 0
> 0
> 1
> 1
> 1
> 0
> 1
> 1
> 0
> 0
> 1
> 1
> 0
> 1
> 1
> 0
> 0
> 1
> 1
> 1
> 1
> 0
> 0
> 1
> 1
> 1
> 1
> 1
> 1
> 1
>
> «grins, ducks, and flees»
>
> Shortenedly-yers,
>
> -tkc


T
H
A
N
K
S

T
I
M
(for the sanity)
 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      10-20-2012
On 2012-10-20, Dennis Lee Bieber <(E-Mail Removed)> wrote:

> Strangely, we've gone from 80-character fixed width displays to
> who-knows-what (if I drop my font size I can probably get nearly 200
> characters across in full-screen mode)...
>
> But at the same time we've gone from 132-character line-printers
> using fan-fold 11x17 pages, to office inkjet/laser printers using 8.5x11
> paper, defaulting to portrait orientation -- with a 10 character/inch
> font, and 1/4" left/right margins, we're back to 80 character limitation
><G>


True, but nobody prints source code out on paper do they?

Seriously -- I can't remember the last time I printed souce code...

--
Grant


 
Reply With Quote
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      10-20-2012
On Sat, 20 Oct 2012 14:18:47 +0000 (UTC), Grant Edwards
<(E-Mail Removed)> declaimed the following in
gmane.comp.python.general:

>
> True, but nobody prints source code out on paper do they?
>
> Seriously -- I can't remember the last time I printed souce code...


Well, having been unemployed for a year, I can't speak much of
recent practice...

But I did tend to run up listings when I had to take over
maintenance of some programs and needed to become familiar with the
overall code base...
--
Wulfraed Dennis Lee Bieber AF6VN
(E-Mail Removed) HTTP://wlfraed.home.netcom.com/

 
Reply With Quote
 
David Robinow
Guest
Posts: n/a
 
      10-20-2012
On Sat, Oct 20, 2012 at 3:10 PM, Dennis Lee Bieber
<(E-Mail Removed)> wrote:
> On Sat, 20 Oct 2012 14:18:47 +0000 (UTC), Grant Edwards
> <(E-Mail Removed)> declaimed the following in
> gmane.comp.python.general:
>
>>
>> True, but nobody prints source code out on paper do they?
>>
>> Seriously -- I can't remember the last time I printed souce code...

>
> Well, having been unemployed for a year, I can't speak much of
> recent practice...
>
> But I did tend to run up listings when I had to take over
> maintenance of some programs and needed to become familiar with the
> overall code base...

Same here. I've been unemployed (retired!) 6 years, but I'd
occasionally print code written by someone else, never anything of my
own.
 
Reply With Quote
 
Walter Hurry
Guest
Posts: n/a
 
      10-20-2012
On Sat, 20 Oct 2012 14:18:47 +0000, Grant Edwards wrote:

> True, but nobody prints source code out on paper do they?
>
> Seriously -- I can't remember the last time I printed souce code...


I remember my first IT job - COBOL programming in the early 80's. The
rule was that every time we delivered a new or updated program into
testing, we had to print a listing onto fanfold paper and hang it, in a
cardboard binder, onto a set of rails which ran down the center of the
office.

I recall even then thinking the practice ludicrous.

 
Reply With Quote
 
Roy Smith
Guest
Posts: n/a
 
      10-20-2012
In article <5081d0c3$0$30003$c3e8da3$(E-Mail Removed) om>,
Steven D'Aprano <(E-Mail Removed)> wrote:

> Some code might be more conveniently written as a single long line. But I
> would argue that nearly never is code more easily *read* as a single long
> line, and since code is read much more than it is written, it is more
> important to optimise for reading, not writing.


Like many people here, I don't worry much about the 80 column limit. I
make my lines of code as long as they have to be, and no longer. If
there's some obvious and easy way to fold the statement onto multiple
lines, I'll do it. If not, I won't.

This tends to result in lines that are less than 80 characters, but if
not, I don't worry about it (assuming I'm even aware of it).

I just did a little experiment. I took about 20 KLOC of python that was
largely written by me and make a histogram of the line lengths
(http://www.panix.com/~roy/length.pdf). Just by eye, I'd say "most are
less than 80, almost all are less than 100". I'd guess the average of
all non-empty lines is about 45 or so. The longest line is 273
characters:

sys.stderr.write("Error: Can't find the file 'settings.py'
in the directory containing %r.\nYou'll have to run django-profile.py,
passing it your settings module.\n(If the file settings.py does indeed
exist, it's causing an ImportError somehow.)\n" % __file__)

Would that have been better rewritten broken up into several shorter
lines? Absolutely. Such is life.

PS: I didn't write that line
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A desperate lunge for on-topic-ness Zero Piraeus Python 24 10-19-2012 10:16 PM
Re: A desperate lunge for on-topic-ness Jean-Michel Pichavant Python 2 10-19-2012 05:59 PM
Re: A desperate lunge for on-topic-ness Mark Lawrence Python 0 10-18-2012 09:12 AM
Re: A desperate lunge for on-topic-ness Demian Brecht Python 0 10-18-2012 06:52 AM
Re: A desperate lunge for on-topic-ness Chris Angelico Python 0 10-18-2012 06:13 AM



Advertisments