News for hackers. Stuff that matters.
Re:Python programming is drowning in red tape by nerdbaggy on Wednesday April 15, 2020 @01:08AM (#22874724)
Line length is such a hard problem to solve. I wish there was a way to be like don’t allow more than 95% percent of my lines to be longer than X.

I run into this in Django a lot with my chained ORM queries. The usually tend to be like 10-15 chars to long. And in this case you have to line break on the parameters or on a ‘.’ which is ugly as well.

While not related to Python, I feel like whenever I write JS code, especially Vue I have a terrible time with line length.

Re:Python programming is drowning in red tape by NegativeLatency on Wednesday April 15, 2020 @11:17AM (#22878713)
If you put some parens around the query you can get a nicer and still pep8 compliant formatting

https://stackoverflow.com/a/11920726

Re:Python programming is drowning in red tape by mandaputtra on Wednesday April 15, 2020 @01:13AM (#22874750)
Agree, I use Vue, Angular and yeah ~ line length pretty much big with formatter,
Re:Python programming is drowning in red tape by runawaybottle on Wednesday April 15, 2020 @01:15AM (#22874755)
It’s an almost impossible problem to solve in JS because breaking up html templates becomes even harder to read.
Re:Python programming is drowning in red tape by raverbashing on Wednesday April 15, 2020 @01:54AM (#22874977)
Yes

My personal preference regarding line lengths: 80 chars are not enough. And even pep8 says that "foolish consistency is the hobgoblin of little minds"

So try being under 80 chars but sometimes you can't. Also don't break a line that's like 85 chars if it will just make it more ugly

I'm glad Prospector by default doesn't enforce "the cult of 80 chars" dogma

Re:Python programming is drowning in red tape by rbanffy on Wednesday April 15, 2020 @03:44AM (#22875488)
God made the VT52 with 80 columns for a reason. ;-)

Now, seriously, that's a matter of taste. I like 80 because it allows me to have two files open side by side on my laptop with a readable font size. As we grow older, what's "readable" changes.

Re:Python programming is drowning in red tape by raverbashing on Wednesday April 15, 2020 @04:03AM (#22875559)
I keep hearing these arguments but to me they sound like a romantic attachment to the past. There's no intrinsic quality in using 80 columns besides historical legacy. But hey we can also keep using the size of body parts as measurement units as well, or we can evolve. :)

The 2 column use case is useful, but to be honest, rare. I just tested it here and I still need a big monitor and a "medium" font size for 2x80 to work (not too bad on the vision side, but not too great neither). But it is easy for that point to become moot ;)

Re:Python programming is drowning in red tape by boomlinde on Wednesday April 15, 2020 @05:03AM (#22875815)
> I keep hearing these arguments but to me they sound like a romantic attachment to the past.

If you think that "I like 80 because it allows me to have two files open side by side on my laptop with a readable font size." sounds like a romantic attachment to the past you should probably just read it over and over again until it doesn't.

Re:Python programming is drowning in red tape by raverbashing on Wednesday April 15, 2020 @05:14AM (#22875859)
Did you read the 2nd paragraph?

Just to be sure, I just tested on my notebook screen (13"): 2x80 doesn't fit with a comfortable font size for me, so maybe we should start using 70 chars?

Re:Python programming is drowning in red tape by rbanffy on Wednesday April 15, 2020 @10:42AM (#22878274)
On my 11 inch I use a single pane. On the 15" it works well when the laptop is on my lap, but less so when it's on the desk but, then, it has two larger monitors, one horizontal and one vertical, so I can still use the two-pane arrangement (typical use is program and test files side by side).

I cut my teeth on the Apple II+, with 40 columns. I agree that 40 columns would be silly, but keeping the text column narrow so that eyes don't need to move too much helps a lot. It's a readability trick used in print since ever. From my position, the horizontal screen spans about 60 degrees, which feels excessive. By the time my eyes marched from left margin to right margin, I already forgot what I was looking for.

Re:Python programming is drowning in red tape by boomlinde on Wednesday April 15, 2020 @05:57AM (#22876054)
I did read the second paragraph, which makes the first paragraph all the more confusing. First you utterly dismiss the argument on an unreasonable basis, and then in the second paragraph you acknowledge that it's useful to be able to do that.

> Just to be sure, I just tested on my notebook screen (13"): 2x80 doesn't fit with a comfortable font size for me, so maybe we should start using 70 chars?

Sure, YMMV. Even when that turns out to be too small for you, less text per line in the editor leaves more horizontal space for something else, for example a file browser sidebar or a terminal. I've done 2x80 on netbooks for what its worth, but the font size that required probably wouldn't be comfortable to me today.

Re:Python programming is drowning in red tape by kd5bjo on Wednesday April 15, 2020 @05:43AM (#22875983)
My aim these days is usually around 70 chars, plus whatever the block indentation is. That way, I can always move the editor viewport to the right to keep the local region on the screen.
Re:Python programming is drowning in red tape by ccmcarey on Wednesday April 15, 2020 @05:08AM (#22875837)
The quote is from Emerson
Re:Python programming is drowning in red tape by dplgk on Thursday April 16, 2020 @09:36AM (#22889185)
How about line wrapping in the text editor?