Last active
March 17, 2021 15:44
-
-
Save thanakijwanavit/a0e707c1d51880502ea0b2764b19a633 to your computer and use it in GitHub Desktop.
sample type checking python and enum bear
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from beartype import beartype | |
from typing import Optional, List | |
from enum import Enum | |
class Animal(Enum): | |
fish=1 | |
cat=2 | |
@beartype | |
def testBeartype(i:int, s:str, a:Optional[Animal]=None): | |
print(s,i, a) | |
testBeartype(5,'4', Animal['fish']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment