Skip to content

Instantly share code, notes, and snippets.

@jeffs

jeffs/virtual.py Secret

Last active August 23, 2021 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffs/e250a3d40b9b46a38b687b16add06ddb to your computer and use it in GitHub Desktop.
Save jeffs/e250a3d40b9b46a38b687b16add06ddb to your computer and use it in GitHub Desktop.
nested-polymorphism-virtual-py
class BlackjackDealer:
def draw(self):
return "🃏"
class Cartoonist:
def draw(self):
return "🖼️"
if __name__ == '__main__':
from sys import argv
print(globals()[argv[1]]().draw())
$ python3 virtual.py BlackjackDealer
🃏
$ python3 virtual.py Cartoonist
🖼️
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment