First, I am fully aware about PEP8, but sometimes it isn't very clear about how should you name things.
Let's assume we have
ABC as an abbreviation.
- Module should be named:
- Class inside the module should be named:
ABC? (not sure)
- Instance variable should be named
# abc.py CONSTANT = "foo" class Abc(object): pass # test.py import abc print abc.CONSTANT abc_ = abc.Abc() # oops, if I use `abc` will lose ability to access abc.FOO ?
If you have a constant inside the
abc module, you may want to access it using
abc.CONSTANT from outside but if you also have the instance with the same name it will not be clear?
If there a clean way to solve this kind of problem? Is the solution different if instead of an acronym you just have a simple word?
Abc() class acts most of the time as Singleton, so for this reason I wasn't able to find another name for the instance.
Module: abc Class: Abc
Instance: the instance can be named like the class, but it is definitively not required. In your case, I'd give the variable a name describing the instance to avoid the naming clash!
class Car: pass audi = Car() myCar = Car() myBrothersCar = Car()