honey-team / ufpy

Ufpy (Useful Python) - package for Python with some useful features
https://honey-team.github.io/ufpy-website
MIT License
3 stars 3 forks source link

type_checker decorator #10

Open bleudev opened 3 months ago

bleudev commented 3 months ago

type_checker decorator edits function for starting checking for types of arguments and return values when function is calling.

@type_checker
def func(a: int, b: float) -> str: ...

func(1, 2.1) # ok
func(1, '2.1') # TypeError

@type_checker
def func2() -> str:
    return 12

func2() # TypeError