4 ms·
I never understood why python allows both spaces and tabs as indentation. Even 2 or 3 spaces sometimes work. It seems odd to allow this and then ask everyone t
by wodenokoto 10y ago
I never understood why python allows both spaces and tabs as indentation. Even 2 or 3 spaces sometimes work.
It seems odd to allow this and then ask everyone to use 4 spaces.
- andrepd 10y agoBecause tabs make much more sense (to me personally) and so I would like to use them, and not have a specific convention imposed on me.
- wodenokoto 10y agoYou will always have syntax imposed on you. With python you have indentation imposed on you, whether you like it or not. In other languages, indentation is a style option. Using tabs makes your python code (potentially) incompatible with other peoples code, due to a style convention. This seems utterly crazy to me. Yes, I prefer tabs too, but this tabs/spaces/different number of space feels like if C had the option of using either curly braces or parenthesis for blocks.
- andrepd 10y agoPoint taken. I wish the decision was done to standardise tabs rather than spaces. But since the convention is now spaces, at least in Python, it would do well do follow those conventions.
- poooogles 10y agoThis has changed a little in Python 3 which disallows mixing the use of tabs and spaces for indentation.
- minitech 10y ago> Even 2 or 3 spaces sometimes work. What? Every number of spaces always works. Anyway, it's nice to separate style recommendations and syntax.