Python Indentation Debate

The cluster centers on debates about Python's significant whitespace and indentation as a syntax feature, including its pros for readability, cons like issues with copying code or newcomers, and comparisons to braces in languages like C, Java, and JS.

📉 Falling 0.5x Programming Languages
4,381
Comments
20
Years Active
5
Top Authors
#8900
Topic ID

Activity Over Time

2007
13
2008
47
2009
100
2010
150
2011
165
2012
192
2013
234
2014
293
2015
236
2016
261
2017
300
2018
246
2019
285
2020
294
2021
318
2022
289
2023
368
2024
290
2025
285
2026
15

Keywords

END JOIN SPECIFY e.g GP JS ML popular.html ANY OF indentation whitespace python code significant blocks block line editor languages

Sample Comments

luckymate Jun 12, 2023 View on HN

Indentation instead of syntax is still a crime.

SamReidHughes Jan 24, 2015 View on HN

It's not like code in other languages isn't indented.

traderjane Jul 7, 2019 View on HN

Does the Python community struggle with indentation? I thought it was largely a non-issue.

twic May 28, 2017 View on HN

This sounds like Python's significant whitespace: weird, off-putting for newcomers, but not actually a problem in practice.

Shorel Jun 15, 2017 View on HN

A counter answer: C is not lisp, why should it be indented with spaces like lisp?

OrderlyTiamat Sep 28, 2022 View on HN

I use python extensively, and whitespace very much is an actual issue. Not a big one, but it is annoying every once in a while e.g. when copying code. Especially as autoindenting is very much hampered in that case, because the editor can't tell what the indent is supposed to be if multiple options are valid python. Dealing with braces instead is much easier. Not a deal-breaker or major issue, but an annoyance nonetheless.

eru Feb 3, 2020 View on HN

No, the indentation is a feature.Your editor can help you with the editing. (And the problem you mention are exactly the same, if you write production code in other language. Your teammates will hopefully insist on consistent indentation in C or Java as well.)

read May 29, 2013 View on HN

Can you elaborate on what put you off Python's indentation?

Sinidir Jun 17, 2022 View on HN

How does the whitespace hurt readability when basically every styleguide and linter in other languages indents code blocks?

kitd Oct 25, 2019 View on HN

No, the indentation is for human readability only.