Modify different objects without checking flags
<p>I am wanting to modify different objects. At the moment I pass a flags parameter to decide whether to perform the changes or not. Is there a way to make this work without passing any flags, or is this the best way of doing it? I dont feel like this is a scalable solution once I have more instances of the objects.</p>

<pre><code>def modifyfunc(self, flags, id_to_modify, value):
  if flags['object1']:
    self.object1.modify(id_to_modify, value)
  if flags['object2']:
    self.object2.modify(id_to_modify, value)
  if flags['object3']:
    self.object3.modify(id_to_modify, value)
</code></pre>

<p>Note that flags can be true for any <code>objectx</code>. Assume that any objectx implements the <code>modify</code> method correctly (basically, the object instances are of different types that inherit from the same base class, so they all have the method <code>modify</code> but may be implemented differently between these objects).</p>