Colab

def oneparam(x):
    return x

oneparam(1,2,3)


    ---------------------------------------------------------------------------

    TypeError                                 Traceback (most recent call last)

    <ipython-input-2-7af8d1116f6b> in <module>
    ----> 1 oneparam(1,2,3)
    

    TypeError: oneparam() takes 1 positional argument but 3 were given


def my_variadic_function_with_cool_name(*args, **kwargs):
    print("type(args)", type(args))
    print("args=", args)
    print("type(kwargs)", type(kwargs))
    print("kwargs=", kwargs)
    return "I am doing nothing"



my_variadic_function_with_cool_name(1,2,3, "blah", first_named=1, second_named_param="blah2", whatever="blah3")

type(args) <class 'tuple'>
args= (1, 2, 3, 'blah')
type(kwargs) <class 'dict'>
kwargs= {'first_named': 1, 'second_named_param': 'blah2', 'whatever': 'blah3'}
'I am doing nothing'
my_variadic_function_with_cool_name()

type(args) <class 'tuple'>
args= ()
type(kwargs) <class 'dict'>
kwargs= {}
'I am doing nothing'
my_variadic_function_with_cool_name(1,2,3)

type(args) <class 'tuple'>
args= (1, 2, 3)
type(kwargs) <class 'dict'>
kwargs= {}
'I am doing nothing'
my_variadic_function_with_cool_name(a=1,b=2,c=3)

type(args) <class 'tuple'>
args= ()
type(kwargs) <class 'dict'>
kwargs= {'a': 1, 'b': 2, 'c': 3}
'I am doing nothing'
print(1,2,3,4,5,6,7,8,10,23432,234,234,234,23423,423,423,4324,234,234,234,23423,4234,234)

1 2 3 4 5 6 7 8 10 23432 234 234 234 23423 423 423 4324 234 234 234 23423 4234 234