I came across this python code base where there is a custom ORM code that maps to MongoDb. I was asked to write new Entities following the existing pattern of code. I have only been writing python code for a week now. But, i find this mix of getter style method name marked as property etc confusing. I know I am not giving a lot of context here. But, I want to discuss how this api looks from a good python programming api pov.
Its python 2.7.
class Entity(object):
def save(self):
...
class Person(Entity):
...
@property
def get_config(self):
return getattr(self, 'config', None)
def set_config(self, config):
self.set('config', config)
...