zip() or what?
sross at connectmail.carleton.ca
Thu Jul 3 16:47:04 CEST 2003
"Ray Tomes" <rtomes at ihug.co.nz> wrote in message
news:3F0401C4.1010306 at ihug.co.nz...
>... I don't get the meaning of the * [snip]. Is this like the opposite of
putting  around something or what?
That's pretty much it. I think of it as an unpacking operator (which it
isn't, but anyway...). You can use it to unpack a list or tuple of arguments
that you want to feed into a function . Conversely, you can use it when
defining a function to say "this function also takes an arbitrary number of
You've seen an example of  for your own problem, here's another quick
def foo(a, b, c):
print "%s %s %s" % (a, b, c)
argfeed = ['a', 'b', 'c']
foo(*argfeed) # equivalent to foo('a', 'b', 'c')
And an example of  would be:
for arg in args:
foo('a', 'b', 'c', 'hello world')
The second useage is in the tutorial [ section 4.7.3 ], I'm not sure where
the first useage is.
More information about the Python-list