Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python type checking

#builtins
isinstance(integer,int)
issubclass(Derived,Base)
type(var)

#pip install danielutils
from danielutils import isoneof,areoneof
isoneof(number,[int,float])

numbers=[...]
areoneof(numbers,[int,float])

#if you need something more robust for functions use validate decorator ->
from danielutils import validate
#ttps://www.google.com/search?q=python+type+validation
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #type #checking
ADD COMMENT
Topic
Name
9+2 =