https://github.com/carlbordum/dynamic-inheritance
o boi
https://github.com/carlbordum/dynamic-inheritance
Last synced: 21 days ago
JSON representation
o boi
- Host: GitHub
- URL: https://github.com/carlbordum/dynamic-inheritance
- Owner: carlbordum
- License: mit
- Created: 2017-10-19T17:55:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-19T18:02:35.000Z (over 7 years ago)
- Last Synced: 2025-02-17T15:49:30.361Z (4 months ago)
- Size: 1000 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dynamic inheritance
A true classic when it comes to OOP patterns; refer to your text book.``` python
import randomclass Cat:
def speak(self):
print('Meow!')class Dog:
def speak(self):
print('Woof!')class RandomAnimal(random.choice((Cat, Dog))):
passif __name__ == '__main__':
RandomAnimal().speak()```
``` python
Woof!
```(please let me know (e.g. submit pr) if you have other awesome ideas)