lo there all,
if i have a function that sometimes needs a value passed to it and sometimes
not, is this where i use *args ?
like this
def some_function(req_var, req_var2, un_req_var):
do some stuff
return value
how would i use this if sometimes i need to process un_req_var and sometimes
2007/1/26, shawn bright [EMAIL PROTECTED]:
lo there all,
if i have a function that sometimes needs a value passed to it and
sometimes not, is this where i use *args ?
No. *args is used if there are arguments that could occur more than once.
like this
def some_function(req_var, req_var2,
shawn bright wrote:
lo there all,
if i have a function that sometimes needs a value passed to it and
sometimes not, is this where i use *args ?
No, use an optional argument.
like this
def some_function(req_var, req_var2, un_req_var):
do some stuff
return value
how would
Greetings,
You could default it to None and check in your script to see if it has changed.
def some_function(req_var, req_var2, un_req_var=None):
if un_req_var != None:
dosomething
else:
dosomethingelse
Wesley Brooks.
On 26/01/07, shawn bright [EMAIL PROTECTED] wrote:
lo
Great, gents, thanks.
tried it out and is working fine, this will clean up a lot of stuff for me.
thanks for your help !
shawn
On 1/26/07, Wesley Brooks [EMAIL PROTECTED] wrote:
Greetings,
You could default it to None and check in your script to see if it has
changed.
def