5 ms·
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 th
by nerdbaggy 7y ago
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.
- mandaputtra 7y agoAgree, I use Vue, Angular and yeah ~ line length pretty much big with formatter,
- runawaybottle 7y agoIt’s an almost impossible problem to solve in JS because breaking up html templates becomes even harder to read.
- raverbashing 7y agoYes 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
- rbanffy 7y agoGod 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.
- raverbashing 7y agoI 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 ;)
- boomlinde 7y ago> 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.
- raverbashing 7y agoDid 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?
- boomlinde 7y agoI 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.
- 7y ago
- ccmcarey 7y agoThe quote is from Emerson
- kd5bjo 7y agoMy 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.
- NegativeLatency 7y agoIf you put some parens around the query you can get a nicer and still pep8 compliant formatting https://stackoverflow.com/a/11920726 https://stackoverflow.com/a/11920726
- dplgk 7y agoHow about line wrapping in the text editor?