Hacker News new | past | comments | ask | show | jobs | submit login

1 - That's the job of a linter

2 - automatically generated code has no obligation to be idiomatic

3 - If I had a cent for every time "idiomatic" code got in the way of readability I'd be a millionaire right now




If writing idiomatic code is causing readability problems your doing it wrong. Successful code is read far more than it's written and even machine generated code needs to be well written to locate bugs etc.

iF YoR CodE LoOks lIKe tHIs, yOu FaIl.


> If writing idiomatic code is causing readability problems your doing it wrong.

Sure, because breaking a 82 char line in python in 2 lines (because pep8) is much more readable than leaving it at 82 chars.


A 65+ character line is already ugly. 80 is an arbitrary but sensible cutoff.


Speak for yourself

a = "a long message with 70 chars..."

vs

a = ("a long message..."

     " with 70 chars...")


You should not be using long messages in code, for one thing you can't localize them across multiple languages. You can do:

  A = \
  "A really long string"
But, the odds are really good you are making a mistake.


Readability is still bad in your example, and not all projects require localization (not to mention usage of \ is not encouraged)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: