[Tutor] apply help (newbie)

Sean 'Shaleh' Perry shalehperry@attbi.com
Sat, 15 Dec 2001 09:19:42 -0800 (PST)


>>> def call(func, *args):
...     print type(*args)
...     apply(func, args)
... 
>>> def foo(a,b,c):
...     print a, b, c
... 
>>> call(foo, 1, 2, 3)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 2, in call
TypeError: type() takes exactly 1 argument (3 given)

*args is python magic for 'expand me in place'.