[Tutor] Passing values of a list as arguments

lonetwin lonetwin@yahoo.com
Fri, 23 Nov 2001 15:48:41 +0530


Hi all,
    I just can't figure out to do this:
====================
def somefunc(arg1, arg2=None)
    if not arg2:
        arg2 = someOtherValue
    ....
    ....
    ....

if __name__ == '__main__':
    somefunc(sys.argv)
====================
    I hope you see my problem, I want to pass the values of sys.argv (or any 
list for that matter) as arguments to somefunction, without resorting to 
something like:
====================
def somefunc(list)
    arg1, arg2 = list[1], list[2] or someOtherValue
    ....
    ....
    ....

if __name__ == '__main__':
    somefunc(sys.argv)
====================
    ....which I think is kinda ugly for more that 3 arg values (python sure 
does makes one *very* picky :))

Peace
Steve
-- 
----------------------------------------------
Every oak tree started out as a 
couple of nuts who stood their ground.
                                    Anonymous
----------------------------------------------