365 Days of Python: Day #29 — Coding Conventions
Programming languages, like written languages, have their own “grammar”.
Granted, this grammar is not grammar in a traditional sense. Rather, it is a set of rules in order to make your code readable to other programmers.
Imagine a world in which a programmer could write his/her code in any style that he/she wishes. It would be mayhem.
Inconsistent variable names, little to no spacing between functions, and comments that read like notes from a diary.
Enter PEP 8: the style guide to rule all style guides.
This style guide was created in 2001 and has been evolving ever since. It provides a means of consistency among Python code and lays the foundation for collaboration between programmers.
PEP 8 covers everything from line breaks to comments to naming conventions and is a great way for beginner programmers (like myself) to learn how to format their code.
It is important to remember, though, that PEP 8 is not to be used as a be-all and end-all. As the style guide states, you are bound to run into situations where its “recommendations just aren’t applicable.”
Day #29 (12/13/2022)
“Learn the rules like a pro, so you can break them like an artist.”