By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,359 Members | 1,481 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,359 IT Pros & Developers. It's quick & easy.

What value should be passed to make a function use the default argument value?

P: n/a
Suppose I have this function:

def f(var=1):
return var*2

What value do I have to pass to f() if I want it to evaluate var to 1?
I know that f() will return 2, but what if I absolutely want to pass a
value to f()? "None" doesn't seem to work..

Thanks in advance.

Oct 3 '06
Share this Question
Share on Google+
50 Replies

P: n/a
"Antoon Pardon" <ap*****
If we somehow want to seperate parameters in those that
can be used with a keyword and those that don't it has
to be something different than providing a default value
to that parameter.
This makes sense - before reading this thread I was under the impression that
giving a variable a default value makes it a keyword variable....

- Hendrik

Oct 14 '06 #51

50 Replies

This discussion thread is closed

Replies have been disabled for this discussion.