When defining an user defined function with parameters, in general a dummy variable is declared. That variable in the function definition can receive values of any type (int, str, list, class instance, etc). But there are situations where we need only a specific data type to receive. Is there any way to restrict that variable to receive values of specific datatype? The following eg gives a clear view
a={1,2,3,4} b={5,6,7,8} c=(1,2,3,4) def func(a,b): print("union = " ,a|b) print("intersection = " ,a&b) print("difference = " ,a-b) print("sym diff = " ,a^b) func(a,b) func(b,c) func(a,4) Here I need to restrict the variables a and b to receive only objects of class set. How can it be done???