Shorten your variable names.
No, really. If you can't fit usual width constraints, it 's a hint that you need some refactoring. Let me get to that.
To remain clear, names should be kept short. On the other hand, you need them to describe the value they are holding, or code they are performing (i case of functions etc.)
If it's hard for you to describe the value and keep the name short, it means that for any person
reading your code it will be most probably even much harder to read and understand, since you make
them concentrate on multiple things.
For comaprison, if I am to write something like:
class App():
def __init__(self):
self.config = {}
self.error = ""
# ...
configDatabaseConnection = mydbmodule.conect(credentials)
configQuery = "this and that"
config = configDatabaseConnection.query(configQuery)
configDatabaseConnectionErrorString = (configDatabaseConection.error)
if configDatabaseConnectionErrorString:
raise configError(configDatabaseConnectionErrorString)
# ...
it normally means that I need to separate the configutation to another method, and use that instead:
class App():
def __init__(self, credentials):
self.config = self.load_config(credentials)
self.error = ""
# ...
self.load_config()
def load_config(self, credentials):
conn = mydbmodule.conect(credentials)
q = "this and that"
config = conn.query(q)
if conn.error:
raise configError(conn.error)
self.config = config
which is much more readable, and allows adding more logic to configuration procedure (say, fall-backs, reading from file instead of db...) without cluttering the gist of my code.