Skip to content

Instantly share code, notes, and snippets.

@kunigami

kunigami/fmix.py

Created Dec 26, 2019
Embed
What would you like to do?
Tmix = TypeVar('Tmix', int, str)
def fmix(a: Tmix, b: Tmix) -> Tmix:
if(random.randint(0, 1) == 0):
return a
return b
fmix('a', 'b') # ok
fmix(1, 2) # ok
fmix('a', 1) # error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.