Importing an output from another function
Ben Cartwright
bencvt at gmail.com
Sat Mar 18 02:02:13 EST 2006
James Stroud wrote:
> Try this (I think its called "argument expansion", but I really don't
> know what its called, so I can't point you to docs):
>
> def Func1():
> choice = ('A', 'B', 'C')
> output = random.choice(choice)
> output2 = random.choice(choice)
> return output, output2
>
> def Func2(*items):
> print items
>
> output = Func1()
> Func2(*output1)
Single asterisk == "arbitrary argument list". Useful in certain
patterns, but not something you use every day.
Documentation is in the tutorial:
http://www.python.org/doc/current/tut/node6.html#SECTION006730000000000000000
PS: Like "self" for class instance methods, "*args" is the
conventional name of the arbitrary argument list.
--Ben
More information about the Python-list
mailing list