🛠️Code Formatter
Also known as Formatter, Black
A tool that fixes the layout of code, like spaces and line breaks, to one style.
Think of it like
Think of it like a robot that folds the laundry. Every shirt comes out folded the same way.
Example
Jack's file has messy spacing. One run of Black, and it matches the rest of the team's code.
Why it matters
When all code looks the same, changes are easier to review. Only real changes show up, not spacing.
Definition
Example code
python
# before
x=[1,2,
3]
# after running black
x = [1, 2, 3]Common mistake
Key takeaways
- 1Layout only. What the code does stays the same.
- 2One style. Everyone's code ends up looking alike.
- 3Run it often. Many editors format on every save.