Skip to content

Instantly share code, notes, and snippets.

@pawelswiecki
Created November 3, 2018 20:48
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 pawelswiecki/c7ffcc6478b109fa7f188b234bf94297 to your computer and use it in GitHub Desktop.
Save pawelswiecki/c7ffcc6478b109fa7f188b234bf94297 to your computer and use it in GitHub Desktop.
from typing import Union
class Food: ...
class Meat(Food): ...
class Chocolate(Food): ...
class Dog:
def eat(self, food: Meat):
pass
class Human:
def eat(self, food: Chocolate):
pass
Animal = Union[Dog, Animal]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment