Our coding style is a collective effort, blending engineering and art, aiming for precision and creativity. The best is yet to come.
Good style advances our design goals: readability, maintainability, performance, and developer experience.
Simplicity unites our design goals, achieving elegance by solving multiple concerns simultaneously.
We maintain a "zero technical debt" policy, aiming to do it right the first time.
- Employ simple control flow and minimal abstractions.
- Limit everything; prevent infinite loops and spikes.
- Use explicit types.
- Assert preconditions, postconditions, and invariants.
- Handle all errors.
- Always explain your rationale.
- Consider performance early.
- Sketch resource usage.
- Optimize bottlenecks.
- Batch operations.
- Be explicit in your code.
- Select precise names.
- Use
snake_case
; follow PEP 8. - Include units in names.
- Write informative commit messages.
- Use comments to explain 'why' and 'how'.
- Avoid unnecessary variable duplication.
- Use immutable structures.
- Build objects in-place.
- Limit variable scope.
- Simplify functions.
- Be cautious with indexes and counts.
- Include units in names.
- Clarify division operations.
- Use code formatters like
black
. - Indent with 4 spaces.
- Keep lines under 79 characters.
- Limit dependencies to essentials.
- Standardize tooling with Python.
- Write cross-platform scripts in Python.
Keep experimenting, have fun, and strive for elegance and efficiency.
“You don’t really suppose, do you, that all your adventures and escapes were managed by mere luck, just for your sole benefit? You are a very fine person, Mr. Baggins, and I am very fond of you; but you are only quite a little fellow in a wide world after all!”
“Thank goodness!” said Bilbo laughing, and handed him the tobacco-jar.