The naming guide
A common set of naming rules can be applied on variables, methods, functions, and properties. The names of classes and modules also play an important role in namespace construction, and in turn in code readability. This mini-guide provides common patterns and antipatterns for picking their names.
Using the has or is prefix for Boolean elements
When an element holds a Boolean value, the is
and has
prefixes provide a natural way to make it more readable in its namespace:
class DB: is_connected = False has_cache = False
Using plurals for variables that are collections
When an element is holding a collection, it is a good idea to use a plural form. Some mappings can also benefit from this when they are exposed like sequences:
class DB: connected_users = ['Tarek'] tables = { 'Customer': ['id', 'first_name', 'last_name'] }
Using explicit names for dictionaries
When a variable holds a mapping, you should use an explicit name when possible. For example, if a...