I am trying to make my code NOT to accept keyword arguments just like some bulitins also do not accept keyword arguments, but, I am unable to do so. Here, is my thinking acc
There isn't such a strong distinction in Python between keyword and positional arguments. In fact, it is as simple as:
Positional arguments are parsed in the order they are listed in the function call Keyword arguments can be added in any order, but cannot come before positional arguments.
So, if you have this:
def foo(x):
pass
You can do:
foo(1) # positional
foo(x=1) # keyword
But you cannot do foo() because you didn't supply a default value.
Similarly, if you have this:
def foo(x,y='hello'):
pass
foo(1) # this works fine
foo() # this is invalid, as an argument without a default isn't passed
foo(y='hello',1) # error - positional arguments come before keyword arguments
Don't forget to read up on arbitrary argument lists.