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, un_req_var): do some stuff return value how would i use this if sometimes i need to process un_req_var and sometimes not ?
Use: def some_function(req_var, req_var2, un_req_var = None): do some stuff return value Now, the function can be called both with and without un_req_var, and if it is called without un_req_var, within the function body un_req_var is considered to be None. -- Andre Engels, [EMAIL PROTECTED] ICQ: 6260644 -- Skype: a_engels
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor