How can we know all possible type of a variable? Consider the following example,
n = int(raw_input())
if n<50:
a = 5
elif n<100:
a = 6.8
else:
a = 'abc'
print type(a)
But, It will give output as either 'int' or 'float' or 'str', depending on value of n...
Can't we have all possible types of a variable? For example the above should give an output something like :
{int,float,str}
You can't determine this at runtime since the type of the variable depends on the execution path. As far as I know, there is no static analysis tool that can do this either.