5 ms·
class A(random.choice([B, C]): ...
by enricozb 5y ago
class A(random.choice([B, C]):
...
- rphln 5y agoI don't know whether to feel disgusted or fascinated by this. I find the concept of prototype-based inheritance quite elegant, but this is a bit too much insane.
- professoretc 5y agoThere was an experimental language called Cecil that had "conditional inheritance". You could say things like class Rectangle: var w,h class Square(Rectangle if w == h): ... You could then overload functions/methods on both `Square` and `Rectangle` and it would call the correct overload depending on the runtime values of `w` and `h`.