4 for Python, 2 for Ruby
It's the law*.
*
https://www.python.org/dev/peps/pep-0008/#indentation
*
https://github.com/styleguide/ruby#coding-style
Also syntactically Python doesn't actually give a shit what you use to indent, just that any given indented block is consistent.
1. Tabs are better than spaces, the PEP guideline is wrong. The PEP guideline is driven by their nutso 79 column code fetish which is also wrong.
2. It's true that Python is safe as long as you're consistent, but it's a nightmare to deal with code that's mixing both on a per-method basis so everyone should convert to the correct side.
3. Several other python PEP guidelines are bad (the advice against importing multiple modules on the same line is bad; you should be able to use spaces in default value declarations in method definitions and function annotations; all naming should be mixedCase [i.e. camlCaseWithLowerFirstLetter], underscores are terrible; the guidance against catching generic exceptions is poor form).
4. 2 spaces is just lunatic fringe. Absolutely awful.
liliththepale said:
any code editor worth its salt can reformat whitespace at the drop of a hat
It's true that it's not difficult to regex \t into " " or vice versa, but consider these several points that I feel strongly about:
1. If the tabs are soft-converted to spaces based on settings in the editor, then everyone always gets what they want in terms of visual indentation. If the tabs are hard-converted into spaces, then each subsequent person who picks it up needs to refactor the code in that way. Just set tab-width / tabstop appropriately and then embrace the tab.
2. When you start using spaces, you run the risk that you work on a file with someone else who uses a different number of spaces, so different methods/functions use different indentation. Even in whitespace-matters languages like Python this is OK, but it becomes a nuisance to work around and the simple regex is no longer possible because you have to ensure you run a separate regex for each block of code. It's true that if you're using a fancy IDE you can just run an automatic code refactor... but
some of us are using nano.
*literally ducks tomatoes being thrown at his head*