Do you add line breaks around related lines of code to make "paragraphs" in Python?

I do this and I think it helps readability. I also like to put a line break before statements like conditionals and withs.

But I've noticed that there's a fair number of Python developers that never put extra line breaks in their code. I'm not sure why.

#python #codestyle

Follow

@sourcenouveau I prefer to put blank lines between functions/methods, not within them. If your function is so long that it needs breaks, either use those lines for explanatory comments or (better yet) break your function into smaller pieces.

Inserting too much whitespace can make a function too long to fit on one screen, making it much harder to read.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.