another newbie question: why should you use "*args" ?
stef
s.mientki at id.umcn.nl
Wed Jan 31 06:41:25 EST 2007
why should I use *args,
as in my ignorance,
making use of a list (or tupple) works just as well,
and is more flexible in it's calling.
So the simple conclusion might be: never use "*args",
or am I overlooking something ?
# method 1
def execute (self, *args):
for i in range ( len(args) ):
... do something
# method 2
def chunk_plot(self, list):
for i in range ( len(list) ):
.... do something
# calling method 1:
execute (S[0], S[4] )
# calling method 2:
execute ( ( S[0], S[4] ) )
# or *the extra flexibility)
mylist = ( S[0], S[4] )
execute ( mylist )
thanks,
Stef Mientki
More information about the Python-list
mailing list