Skip to content

Convert arguments to the correct type in the function signature.

License

Notifications You must be signed in to change notification settings

meirdev/implicit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

implicit

Implicit is a decorator that converts arguments to the correct type in the function signature.

Example

from implicit import implicit


@implicit
def add(a: int, b: int) -> int:
    return a + b


add("1", "2")  # 3

Use exclude to exclude a argument from being converted:

from implicit import implicit


@implicit(exclude=["a"])
def add(a: int, b: int) -> int:
    return a + b


add("1", "2")  # TypeError: can only concatenate str (not "int") to str

Disclaimer

This is only idea, don't use it.

About

Convert arguments to the correct type in the function signature.

Topics

Resources

License

Stars

Watchers

Forks

Languages