python - Ignore passed arguments -


is possible ignore passed/overgiven arguments in method?

here example want do:

def event_handler(one, two):    print(one)    print(two) 

and @ place:

event_handler(one, two, three) 

i mean third argument optional. i've tried in python fiddle, doesn't work without error.

make third default argument

def event_handler(one, two, third = none): 

then error handling, default, easy.

def event_handler(one, two, third = none):    print(one)    print(two)    if (three):         print(three) 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -