Haskell has the choice of both indentation based and brackets for things like do blocks, but most people use indentation based cause it’s the norm and looks cleaner
Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3.
Whatever your place defines as a standard. I’ve seen ugly code in C, JavaScript, Java, etc., that uses them all over the place because they’re not mandatory.
If you don’t have consistent indenting, your code looks like copy/paste from several sources; but if you do have consistent indenting, then the indenting of Python is a non-issue.
List comprehensions are much stranger than tabs vs spaces. There are very very very few languages that use them, and python’s is by far the worst out of the popular ones.
This is the one thing I hate about python, because the spacing would differ between editors. I used vim to create the files on one system, and geany to edit them on another. Via uses 8 spaces in a tab (at least for me), while geany uses 4. This makes python mad, and drives me crazy.
Also, the rules for whitespace separation between things like loops, methods, and the rest of the code is annoying/ wierd (at least to me).
and that indentation defaults in decent editors are usually language dependent. I’m not familiar with these editors, but… come on - if they use one default for all files, OP should use a better tool.
Yes, but I don’t normally program in python, so I never did. When I had to, I never thought of changing it (it wasn’t for long anyways and was less of a thought out decision to do programming in vim)
FORTRAN isn’t a beauty either.
And Python is strange as hell with its mandatory tabs.
You can use spaces in Python.
Indentation-driven control flow is one of the most cursed things ever invented, excluding things explicitly designed to inflict pain or death.
Haskell has the choice of both indentation based and brackets for things like
doblocks, but most people use indentation based cause it’s the norm and looks cleanerWhite space sensitive languages are evil.
Two, three or four spaces? If you answer wrong I’ll never forgive you
No one will ever know. That is my editor’s job. XD
Per the Linux kernel coding style:
Whatever your place defines as a standard. I’ve seen ugly code in C, JavaScript, Java, etc., that uses them all over the place because they’re not mandatory.
If you don’t have consistent indenting, your code looks like copy/paste from several sources; but if you do have consistent indenting, then the indenting of Python is a non-issue.
I’m rather partial to five myself but only when I’m feeling fancy.
Yes
List comprehensions are much stranger than tabs vs spaces. There are very very very few languages that use them, and python’s is by far the worst out of the popular ones.
Skill issue. Once you learn them they are quite fun.
The concept of a list comprehenshion is sinple but syntax is awful, as if Yoda was writing a for loop. “x for x in y it is, hmm yes”.
Wasn’t the python convention to use spaces (4 iirc)? Which is just plain wrong imho.
most repos use 4 spaces
This is the one thing I hate about python, because the spacing would differ between editors. I used vim to create the files on one system, and geany to edit them on another. Via uses 8 spaces in a tab (at least for me), while geany uses 4. This makes python mad, and drives me crazy.
Also, the rules for whitespace separation between things like loops, methods, and the rest of the code is annoying/ wierd (at least to me).
You know that editors let you change their defaults, right?
and that indentation defaults in decent editors are usually language dependent. I’m not familiar with these editors, but… come on - if they use one default for all files, OP should use a better tool.
Yes, but I don’t normally program in python, so I never did. When I had to, I never thought of changing it (it wasn’t for long anyways and was less of a thought out decision to do programming in vim)
Get a code formatter. Ruff is popular. So is black. Never think about it again.