In python is it possible to have the above code without raising an exception ?
def myfunc():
pass
# TypeError myfunc() takes no arguments (1 given)
myfunc('param')
Usually in php in some circumstances I launch a function without parameters and then retrieve the parameters inside the function.
In practice I don't want to declare arguments in myfunc and then passing some arguments to it. The only one solution I found is myfunc(*arg)
. Are there any other methods ?