Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

At first, I thought "wow, Python generator expressions are really ugly nested". This is especially true after working with C#3/Linq because query expressions have natural places for line breaks and read in a more consistent order.

Later, I ran into some cases where I wanted a multi-line lambda. And my thought was "aaragh134!#?!"

Then, a weird thing happened. I started making a conscious effort to follow PEP 8. 79 column limit? Seriously? That sucks. But after weeks of struggling with it, something finally hit me. I realized I was writing better code by forcing myself to reduce code density. Sure, it was a little bit longer, but I spend way more time reading it than writing it.

Stop trying to fight it; assign a name to that lambda. Readability counts.

Stop trying to be clever; assign a name to that inner expression. Flat is better than nested.





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

Search: