Functions and Methods
The following convention should be followed for def naming:
- Avoid inbuilt names.
snake_caseor descriptive single word in lowercase should be used.- function names should explain the functionality.
- for bound methods in class
selfshould be used for first argument. - for class methods in class
clsshould be used for first argument. decoratorsshould be named in function convention.
def get_db_connection(username, db_name):
return connection
#method
def get_db_connection(self, username, db_name):
return connection
# classmethod
@classmethod
def multiple_param_initializer(cls, cls_param):
return cls(cls_param)