What is the best way to design a class to see if an update occurs on a property?

I have a whole bunch of classes, and current am going through a re-design of the python package I created. Essentially what I do is take the values of a REST service description, and put them into a class along with the functions that can operate on that service.

I have a bunch of design questions:

  1. Can I have a bunch of base classes like: Map Service, Feature Service where the functions are defined, but not the properties and create classes on the fly? Is that possible or recommended? Right now I have everything defined for each service type, but I'm trying to see if there is a way to shrink my code base.
  2. Should I use the get/set properties to track changes and just have a variable called isChanged default set to False and when one property is changed, then change it to True, or is there another way to do this? This relates back to question #1. If I do this by defining each property, then I need a different way to track class changes.
  3. Since the operations function on web services, should I make them asynchronous and support callback functions? Can anyone provide samples/guidelines on how to properly design a class to support this?

My classes all inherit from object, thus allowing the use of the get/set notation. Example: @property

Thank you for any insight you may provide.

  • Does it? That's what I'm trying to figure out. Can you point to some links/docs on these patterns? Commented Jul 1, 2015 at 13:59

1 Answer 1


You could create @property decorated functions. In the setter one, you make sure you have something that calls all the pre-defined callback for said property. This is a visitor pattern really.

So, in untested and incomplete code, something akin to this:

def ook(self, value):
    self._whatever = ook
    for func in self._ook_callbacks:
  • Thank you, I am going read this over and see what I find. I think it looks like what I need. Commented Jul 6, 2015 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.