1def logic_mixin_factory(mass, mass_attr_name, material,
2 material_attr_name, float_method_name):
3
4 class LogicMixin:
5
6 def is_a_witch(self):
7 is_witch = "Burn her!"
8 is_not_witch = "No, but it's a pity, cuz she looks like a witch!"
9
10 if getattr(self, mass_attr_name, None) == mass:
11 return is_witch
12 if getattr(self, material_attr_name, None) == material:
13 return is_witch
14 if callable(getattr(self, float_method_name, None)):
15 return is_witch
16
17 return is_not_witch
18
19 return LogicMixin
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK