For example:
def fooify(x):
if isinstance(x, list):
map(fooify, x)
else:
x * 2
I guess this is to make scripting more forgiving.In typical typed languages, you would have two functions instead:
fooify : number -> number
fooifyMany : [number] -> [number]
But in the Python community, it's common to have a big function with many behaviors. However, then the type annotations cannot be so precise: fooify : any -> any
Not an experienced Python dev, so curious how this works in practice.