Naming Conventions - SaratogaEDD2014/RapidPrototyper GitHub Wiki
Most of us are used to java, not python. This is a quick guide to Python naming conventions for us to use. For a very thorough explanation of popular conventions, refer to: PEP-8.
General Rules:
Name classes with TitleCase:
- ex. class MyClass:
Name functions and public methods withe lowercase_and_underscores:
- ex. def my_awesome_function():
- ex. def my_public_method(self):
Name internal methods (not meant to be called from any other class) like a function, but with _leading_underscore:
- ex. def _user_doesnt_see_meth(self)
Module names should be lowercase, and have few underscores:
- ex. my_module.py, import my_module
Avoid using too many mutator and accessor methods, just allow attributes to be accessed directly. For consistency, use python's built-in property function if you require a small amount of computation when accessing data.
Also, wxPython does not make a point to follow these conventions, which could make things extremely confusing if we have multiple conventions going at the same time. I think the best thing to do would be to follow standard conventions when we are writing original classes, but to follow the wx model of having TitleCase function names when we are extending their classes.