I want to get the type of arguments being passed to a method
for eg.
am expecting an output like :
num -- type int
string -- type string
am able to retrieve it from isinstance method if i get arguments from sample(1,'hello '), but not with (num,string)
which returns
num -- type string
string -- type string
I can understand that these args are assigned with types only during their manipulations
for e.g function sample will throw me a type error if i try to do
num + string
but when constructed using the PyObject they must have been definitely assigned with a data type like char or int
how can i retrieve it if they are defined with PyObjects ?
for eg.
Code:
def sample(num,string): print num print string sample(1,'hello')
num -- type int
string -- type string
am able to retrieve it from isinstance method if i get arguments from sample(1,'hello '), but not with (num,string)
which returns
num -- type string
string -- type string
I can understand that these args are assigned with types only during their manipulations
for e.g function sample will throw me a type error if i try to do
num + string
but when constructed using the PyObject they must have been definitely assigned with a data type like char or int
how can i retrieve it if they are defined with PyObjects ?
Comment