question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(Very) Long lines in exercises

See original GitHub issue

I agree that by now PEP8 is dated and modern setups easily and conveniently display more than 79 characters in a line of code. However, I’m not aware of any widely used conventions or IDEs that go beyond 120 characters by default (most likely for the sake of readability).

In that regard, there is a handful of violators within exercises, namely - presented as LONGEST_LINE_LENGTH, FILENAME, LONGEST_LINE_CONTENTS - the following:

1734 exercises/concept/cater-waiter/sets_test_data.py {'dried fenugreek leaves', 'apple cider vinegar', 'cinnamon sticks', 'roasted chicken', 'cumin', 'mangoes', 'heavy cream', 'micro cilantro', 'white vinegar', 'red chili powder', 'cinnamon powder', 'mustard seeds', 'red wine vinegar', 'mirin', 'cinnamon', 'green chili', 'avocado oil', 'curry leaves', 'star anise', 'dijon mustard', 'crunchy peanut butter', 'grilled king fish', 'chicken', 'fresh basil', 'cashew nuts', 'pink peppercorns', 'pork belly', 'spinach', 'watercress', 'whole small crimini mushrooms', 'coconut flour', 'fresh ginger', 'fennel bulb', 'harissa', 'tahini', 'mozzarella cheese', 'scallions', 'sriacha', 'fresh parsley', 'thyme', 'light soy sauce', 'cream cheese', 'hing', 'coriander seeds', 'sour cream', 'turmeric powder', 'castelfranco radicchio', 'parmesan', 'toasted buckwheat', 'coriander powder', 'dark soy sauce', 'granny smith apples', 'parsley', 'shrimp', 'garlic paste', 'roasted peanuts', 'turmeric', 'carrot', 'garam masala', 'clove powder', 'cucumbers', 'tomato paste', 'almond meal', 'dutch carrot', 'brussel sprouts', 'red and green thai chili', 'shallots', 'nigella seeds', 'cardamom powder', 'watermelon radishes', 'flaxmeal', 'cilantro', 'fennel seeds', 'chipotle chili', 'ghee', 'parmesan cheese', 'radishes', 'pork chops', 'cilantro leaves', 'fresh greek yogurt', 'cardamom', 'mango powder', 'onion', 'oregano', 'fresh red chili', 'pecans', 'salmon fillets', 'basil', 'green cabbage', 'cumin powder', 'almond flour', 'lemon', 'boned chicken', 'oyster sauce', 'soy sauce', 'little gem lettuce heads', 'peanut oil', 'peanuts', 'caster sugar', 'salmon steaks', 'ginger garlic paste', 'green onions', 'vinegar', 'cloves', 'kecap manis', 'avocado', 'chili flakes', 'red chili flakes', 'tomatoes'},
1019 exercises/practice/largest-series-product/largest_series_product_test.py                 "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450",
434 exercises/practice/house/house_test.py                 "This is the horse and the hound and the horn that belonged to the farmer sowing his corn that kept the rooster that crowed in the morn that woke the priest all shaven and shorn that married the man all tattered and torn that kissed the maiden all forlorn that milked the cow with the crumpled horn that tossed the dog that worried the cat that killed the rat that ate the malt that lay in the house that Jack built.",
138 exercises/practice/say/say_test.py             "nine hundred eighty-seven billion six hundred fifty-four million three hundred twenty-one thousand one hundred twenty-three",
129 exercises/concept/making-the-grade/loops_test.py                                  msg=f'Expected: {result} but the grade thresholds for a high score of {highest} are incorrect.')
126 exercises/concept/little-sisters-vocab/strings_test.py         result_data = 'en :: encircle :: enfold :: enclose :: enjoy :: enlighten :: entangle :: enable :: encode :: enculture'
122 exercises/concept/restaurant-rozalynn/none_test.py             accommodate_waiting_guests(starting_reservations, ["Mort", "Suze", "Phillip", "Tony"]), starting_reservations,
121 exercises/practice/bowling/bowling_test.py     def test_the_second_bonus_rolls_after_a_strike_in_the_last_frame_cannot_be_a_strike_if_the_first_one_is_not_a_strike(
121 exercises/concept/cater-waiter/sets_categories_data.py                        'toasted bread', 'parmesan', 'beef', 'tofu', 'flour', 'tomatoes', 'red onion', 'slivered almonds',

obtained by running

find exercises -type f -name "*.py" | while read file; do
  cat "$file" | awk -v f="$file" 'length > 120 {print length, f, $0}' | sort -n | tail -1
done | sort -nr

Should something be done about those? Happy to contribute.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
BethanyGcommented, Nov 29, 2021

Now that @J08K has finished linting (THANK YOU). I think we can safely close this issue.

1reaction
BethanyGcommented, Sep 14, 2021

Happy to have an ongoing discussion in this issue, but I am going to flag this as stats “on hold”, simply because we need to focus on higher-priority issues such as adding new concepts and exercises, updated tooling, and fixing obvious errors and typos in existing exercises.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exercise 1.22 - fold long lines - Learn To Solve It
Write a program to fold long input lines into two or more shorter lines after the last non-blank character that occurs before the...
Read more >
The Myth of Long, Lean Lines In Pilates and Barre - InStyle
Problem is, some people will never achieve long, lean lines. No matter what type of exercise routine they do. And that's 100 percent...
Read more >
K&R2 solutions:Chapter 1:Exercise 22 - clc-wiki
Write a program to "fold" long input lines into two or more shorter lines after the last non-blank character that occurs before the...
Read more >
LONG LINING 101 - YouTube
Hope you found this video helpful!Please comment and leave me your feedback!! Follow the link over to my Facebook page and Instagram too...
Read more >
Kernighan and Ritchie C exercise 1-22 (fold long input lines)
The exercise is the following: "Write a program to ''fold'' long input lines into two or more shorter lines after the last non-blank ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found