For your particular case of a diamond, the solution below seems
simpler to me than yours. What problems may it create which your
solution won't? Or you might refine the problem. It's not easy to
see the real value of your suggestions.
```
class HighGobelin:
def scream(self):
self._speak()
print("raAaaaAar")
def _speak(self):
return
class CorruptedGobelin(HighGobelin):
def _speak(self):
print("my corrupted soul makes me wanna scream")
class ProudGobelin(HighGobelin):
def _speak(self):
print("I ... can't ... contain my scream!")
class HalfBreed(ProudGobelin, CorruptedGobelin):
@property
def _speak(self):
return super(
__class__ if random.choices([True, False])
else ProudGobelin,
self
)._speak
```
Best regards,
Takuo Matsuoka
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/JNZEO3PWUG225OBOSKRMPHEYEYAXDUXC/
Code of Conduct: http://python.org/psf/codeofconduct/