I'm learning Python lately (Dec.'20) and found this concept is very convoluted. Let's say I have a function. How can I tell if a particular objects type can be applied to this kind of function overloading?
def compute(a, b, c):
return (a+b) * c
It works fine with some of these object type - number, string, but not others.
>>> a, b, c=1,2,3
>>> a, b, c = 'hi', 'U', 3 # okay
>>> a, b, c = [1], [2,3], 3 # okay
>>> a, b, c = {1}, {2}, 3 # it's set()
"string" * 3 = "stringstringstring"however where you have used {} curley bracket. These cannot have maths done to them{1} - {2}is legal. The problem is that sets don't support+.