I have created a class that has a property with a setter. There are 2 different ways to use this class, so the values of some of the object components may be set in a different order depending on the scenario (i.e. I don't want to set them during __init__). I have included a non-property with its own set function here to illustrate what is and isn't working.
class Dumbclass(object):
  def __init__(self):
    self.name = None
    self.__priority = None
  @property
  def priority(self):
    return self.__priority
  @priority.setter
  def priority(self, p):
    self.__priority = p
  def set_name(self, name):
    self.name = "dumb " + name
  def all_the_things(self, name, priority=100):
    self.set_name(name) 
    self.priority(priority)
    print self.name
    print self.priority
When I run the following, it returns TypeError: 'NoneType' object is not callable. I investigated with pdb, and found that it was calling the getter instead of the setter at self.priority(priority).
if __name__ == '__main__':
  d1 = Dumbclass()
  d1.all_the_things("class 1")
  d2 = Dumbclass()
  d2.all_the_things("class 2", 4)
What's going on here?
 
     
     
    