Comments (4)
No, tabs for indentation are the devil. Making this configurable would go against Black's philosophy.
from black.
Python is a language that is conscience of spaced alignment. requiring which requires consistency in the offset of the characters from the newlines.
tabs for indentation are the devil.
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
to tabulate was to make spaced words flat
while
to indent was to create two inequal sections on a sheet.
http://webstersdictionary1828.com
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
(transitive) To arrange in tabular form; to arrange into a table.
(transitive) To set out as a list; to enumerate, to list.
https://en.wiktionary.org/wiki/tabulate
tabular (comparative more tabular, superlative most tabular)
having a flat, plane surface
organized as a table or list
calculated by means of a table
https://en.wiktionary.org/wiki/tabular
indent (plural indents)
A cut or notch in the margin of anything, or a recess like a notch.
https://en.wiktionary.org/wiki/indent
Tabs notch the text in an flat, organized and calculateble way.
Furthermore:
The fact that "line length" is configurable in Black's philosophy but characters for indentation is not, is intellectually inconsistent. Please consider becoming intellectually consistent in this use case.
from black.
@BrettMoan we appreciate your thorough comment but this will not be supported by Black.
from 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.
from black.
Related Issues (20)
- Black keeps reformatting some code chunks back and forth between 2 different representations HOT 6
- formatting fails if the file is located on a network drive HOT 4
- line-length is not working as intended HOT 1
- newline after opening braces causes parser error HOT 1
- Docstrings not part of a function are incorrectly labeled as non-equivalent code HOT 1
- A bug when replacing quote variations HOT 1
- black 24.4.0 returns error when parsing valid Python fstring sentence HOT 1
- f-string internal formatting to be consistent with non-f-string formatting HOT 1
- INTERNAL ERROR HOT 1
- precommit black doesn't read from `pyproject.toml` file. HOT 1
- Line too long: string literal doesn't get split HOT 1
- Black fails with match-case statement with multiple branches HOT 2
- PEP 701 support breaks stability policy HOT 10
- Black cannot parse previously parseable file in 24.4.1 HOT 14
- black 24.4.1 hangs with python 3.10.12 HOT 6
- Black not deleting unnecessary brackets HOT 3
- Cannot format f-strings where the contents re-use the same quotes as the enclosing f-string HOT 1
- 24.4.2: pytest fails in tests/test_format.py with `AssertionError` HOT 3
- Cannot parse multiline f-string containing multiline string HOT 1
- Is there any way to have a permalink for a specific version in the changelog doc? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from black.