What's the business with the asterisk?

mk mrkafk at gmail.com
Sat Jan 24 07:31:03 EST 2009


Hello everyone,

 From time to time I spot an asterisk (*) used in the Python code 
_outside_ the usual *args or **kwargs application.

E.g. here: http://www.norvig.com/python-lisp.html

def transpose (m):
   return zip(*m)
 >>> transpose([[1,2,3], [4,5,6]])
[(1, 4), (2, 5), (3, 6)]

What does *m mean in this example and how does it do the magic here?

Regards,
mk





More information about the Python-list mailing list