On Wed, 13 Apr 2022 at 15:02, Ganesh B <[email protected]> wrote:
>
> I hope nicer on the code text please.
Sure. Sorry about that. malmiteria's "lib" code is
```
class HighGobelin:
def scream(self):
print("raAaaaAar")
class CorruptedGobelin(HighGobelin):
def scream(self):
print("my corrupted soul makes me wanna scream")
super().scream()
class ProudGobelin(HighGobelin):
def scream(self):
print("I ... can't ... contain my scream!")
super().scream()
```
Best regards,
Takuo Matsuoka
>
> On Wed, Apr 13, 2022 at 9:21 AM Matsuoka Takuo <[email protected]> wrote:
>>
>> On Wed, 13 Apr 2022 at 04:28, malmiteria <[email protected]> wrote:
>> >
>> > Idk, what do you think?
>>
>> I would need to see more examples to determine the limit of the
>> current strategy for method resolution and super. For the example at
>> hand, I can be happy with the following code as a lib user (using your
>> lib code).
>>
>> ```
>> class Proud_base(HighGobelin):
>> scream = HighGobelin.scream
>>
>> class ProudGobelin_floating(ProudGobelin, Proud_base):
>> pass
>>
>> class HalfBreed(ProudGobelin_floating, CorrupteGobelin):
>> def scream(self):
>> if random.choices([True, False]):
>> super(HalfBreed, self).scream()
>> else:
>> super(Proud_base, self).scream()
>> ```
>>
>> Best regards,
>> Takuo
>> _______________________________________________
>> 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/K63MS6XAS3OXGYDU4N47VIFMPNAWX2Z7/
>> Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
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/PX3LKNVFKHIE2MH7BYHC4JZT2E24TQQN/
Code of Conduct: http://python.org/psf/codeofconduct/