As you probably already know that PEP 8 is a style guide for Python. If you are a developer with Python experience, the style itself would be pretty recognizable for you. It’s been widely adopted by the Python community and almost all the packages and frameworks exclusively built in/for Python use PEP 8.
Even though Python is a widely used language in the VFX, animation and game sectors as well, it’s not the only one. You could end up using more than three programming languages, several frameworks and APIs based on what department you work in and what kind of task you are assigned to. Majority of the libraries, frameworks and APIs used in these sectors are designed and developed with camel case style guide.
Example APIs and Frameworks with camel case style guide.
- Maya C++ API
- Maya Python Modules (also MEL)
- Houdini C++ API
- Houdini Python Modules
- Nuke C++ API
- Nuke Python Modules
- Qt (C++)
- PySide, PyQt (Python)
Clearly a decision needs to be made considering these two style guides and their impact on our work. Should we choose and use only one, or simply use them both?
It doesn’t sound good to me to switch to one another style guide just for one language while working with all of these APIs that use camel case style guide. This is mainly because of a very important concept called consistency that we all care/should care so much about. Not only switching one style guide to another would make things inconsistent but it would also make you less productive while you type, since you would already have a developed muscle memory for one particular style guide.
Though, the most important point I would like to make in this article given its context is consistency when it comes to choosing a style guide. Let me explain a bit more.
Imagine you are asked to use Python for any given job / project outside of the sectors I’ve mentioned above. In such a case it’s more than likely for you to work with other Python packages developed with PEP 8, therefore it would be most logical and productive to choose PEP 8.
However, it would be a better choice to follow camel case style guide if you work in one of the sectors I’ve mentioned above. By doing so you would produce a consistent code base while working more productively with all the libraries, frameworks and APIs also mentioned above. This is of course if you do not already have a well established code base with another style guide, such as PEP 8.
In case you already have a well established code base with PEP 8, you should stick to it for consistency, regardless you have to use libraries, frameworks and APIs that are developed with another style guide such as camel case.
The table below illustrates my point.
|Condition||Camel Case||PEP 8|
|Working only with Python, libraries, frameworks and APIs written in Python.||✓|
|Working with Python along with different libraries, frameworks and APIs that are written with camel case style guide.||✓|
If you start developing from scratch with no legacy source code
If you already have well established PEP 8 source code
I personally prefer camel case style guide for obvious reasons that I’ve mentioned. Though, it’s not like I never used PEP 8 before. I did and always follow what has already been established as a style guide when I get on board for a project. This is because consistency is far more important than personal preferences. More on that later.