-
Notifications
You must be signed in to change notification settings - Fork 2.4k
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for tab indentation #47
Comments
No, tabs for indentation are the devil. Making this configurable would go against Black's philosophy. |
Python is a language that is conscience of spaced alignment. requiring which requires consistency in the offset of the characters from the newlines.
this is as ignorant as it is absurd The "tab" key was named in the 1900s, and is based off of the definitions of words, at that time. at that time at that time, "to indent" text was "to tabulate" Tab stops create alignment, originally for mathematical tables. Python uses alignment for code blocks. tabs are the natural character for this purpose, not spaces. Furthermore, even the modern definitions show that tabulation and indentation go hand in hand. tabulate tabular (comparative more tabular, superlative most tabular) indent (plural indents) Tabs notch the text in an flat, organized and calculateble way. Furthermore: |
@BrettMoan we appreciate your thorough comment but this will not be supported by Black. |
@BrettMoan, whipping out Wiktionary feels rather condescending. I don't understand how you expected to change anybody's mind that way, let alone by starting with that I am ignorant and absurd. What is ignorant and absurd is fighting against PEP 8, defined in 2001, eighteen years later. Tabs might be theoretically better but that ship has sailed a very long time ago. Black's code style is opinionated and that is one of the opinions. Four spaces. Done. The goal behind it is to unify as much community around this as possible, especially programmers and teams who haven't form an opinion yet. I won't present tabs as an option because it is not a valid one. The Python community moved on. If your editor is configured to use tabs for Python indentation, that means you are unable to meaningfully contribute to any open source software, including Python itself. Some code editors and other tooling will be confused by tabs in Python indentation, leading to mixed spaces and tabs which is not supported on Python 3. |
Black always output 4 spaces for indentation.
It would be nice to have a --use-tabs or similar to tell it to output tabs instead. By manually switching the ' '*self.depth into '\t'*self.depth in the Line.str() method it seems to support this rather nicely.
I'm not sure if there are other edge cases to consider (i see another ' ' literal in the code but i don't understand when it applies)
Would something like this be considered ?
The text was updated successfully, but these errors were encountered: