I&#39;m trying to design a base class for a hierarchy. &nbsp;The properties I want to specify for the base class depend on the values of other properties of the base class. &nbsp;For instance, in this toy example of a base FoodProcessor class:<div>
<br><div>class FoodProcessor:</div><div>&nbsp;&nbsp; &nbsp;&quot;Model for a kitchen appliance food processor&quot;</div><div>&nbsp;&nbsp; &nbsp;speed_settings &nbsp; &nbsp; # example [1, 2, 3, 4]</div><div>&nbsp;&nbsp; &nbsp;blade_settings &nbsp; &nbsp; &nbsp;# example [&quot;slice&quot;, &quot;grate&quot;, &quot;grind&quot;]</div>
<div>&nbsp;&nbsp; &nbsp;slice_thickness &nbsp; &nbsp; # example [&quot;thin&quot;, &quot;thick&quot;], but only if blade_setting is &quot;slice&quot;</div><div><br></div><div>it only make sense to have the slice_thickness property set when blade_settings = &quot;slice&quot;; otherwise, it would be preferable to only define the speed_settings and blade_settings properties. &nbsp;For example:</div>
<div><br></div><div>class ProcessorA(FoodProcessor):</div><div>&nbsp;&nbsp; &nbsp;&quot;A slicing-only processor&quot;</div><div>&nbsp;&nbsp; &nbsp;speed_settings = [1, 2, 3, 4]</div><div>&nbsp;&nbsp; &nbsp;blade_settings = &quot;slice&quot;</div><div>&nbsp;&nbsp; &nbsp;slice_thickness = [&quot;thin&quot;, &quot;thick&quot;]</div>
<div><br></div><div>class ProcessorB(FoodProcessor):</div><div>&nbsp;&nbsp; &nbsp;&quot;A non-slicing processor&quot;</div><div>&nbsp;&nbsp; &nbsp;speed_settings = [1,2,3,4] &nbsp;&nbsp;</div><div>&nbsp;&nbsp; &nbsp;blade_settings = [&quot;grate&quot;, &quot;grind&quot;]</div>
<div>&nbsp;&nbsp; &nbsp;slice_thickness = None</div><div><br></div><div>Can anyone suggest some work-arounds, or refactoring for this type of design? &nbsp;Is there a design pattern for this?</div><div><br></div><div>Thanks!</div><div>Marcus</div>
<div><br></div><div><br></div><div><br></div></div>