Код: Выделить всё
>>> myfunc("strawberry")
ok
# myfunc only works with strawberry
Код: Выделить всё
def myfunc(something):
if something == "strawberry":
print("ok")
Примерно так:
Код: Выделить всё
def myfunc(something: OnlyThese["strawberry", "cake"]):
print("ok")
Подробнее здесь: https://stackoverflow.com/questions/702 ... n-function