Let's say I have this function code:
def dosomething(thing1, thing2='hello', thing3='world'):
print(thing1)
print(thing2)
print(thing3)
When calling it, I would like to be able to specify what thing3 is, but without having to say what thing2 is. (The code below is how I thought it might work...)
dosomething("This says 'hello fail!'", , 'fail!')
and it would say:
This says 'hello fail!'
hello
fail!
So is there a way to do it like that, or would I have to specify thing2 every time I wanted to say what thing3 was?
thing2,3are named (kwarg) arguments. And the way you attempted to do this in your code was by trying to pass them by positional association, but omitting thing2; however "This...", , "fail!" is a syntax error, you can't have two commas after each other and no value. So you need named association(...thing3=='fail!').