It works for me.

[EMAIL PROTECTED]:~> python /tmp/q.py
hello
there
[EMAIL PROTECTED]:~> cat /tmp/q.py 
list = ["hello", "there"]

def printout(firstword, secondword):
    print firstword                 
    print secondword
        
printout(*list)

What does it do?

It passes the arguments from an iterable.

It works the other way too:

def help(*args):
    print help
    
help()      => prints ()
help(1,2,3) => prints (1,2,3)

Andreas


* Stevie Broadfoot <[EMAIL PROTECTED]> [070426 16:08]:
>    This is the best answer i've gotten so far... but its still not working...
> 
>    what exactly does the star do?
> 
>    the other solutions people provided do not suit my needs, my printout
>    function was just an example, what i need it for is more complicated.
>    I actually just need to feed the members of the list into the function...
>    and this is to be applied to different functions with different numbers of
>    arguments needed.
> 
>    On 4/26/07, Andreas Kostyrka <[EMAIL PROTECTED]> wrote:
> 
>      * Stevie Broadfoot <[EMAIL PROTECTED]> [070426 09:56]:
>      >    I have a list... say for example
>      >
>      >    list = ["hello", "there"]
>      >
>      >    and i have a function
>      >
>      >    def printout(firstword, secondword):
>      >        print firstword
>      >        print secondword
>      >
>      >    and i want to call
>      >
>      >    the function like this
>      >
>      >    printout(list)
>      printout(*list)
> 
>      Andreas
> 
> References
> 
>    Visible links
>    1. mailto:[EMAIL PROTECTED]
>    2. mailto:[EMAIL PROTECTED]
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to