Quoting Luke Jordan <[EMAIL PROTECTED]>:

> But this does not:
> 
>  def aFunc(configArg):
>  print "aFunc with argument"
>  print configArg
> 
>  def anotherFunc(configArg):
>  print "anotherFunc with argument"
>  print configArg 
>  return aFunc,1
   ^^^^^^^^^^^^^^

>  def dispatch(func,configArg):
>  while func is not None and configArg is not None:
>  func = func(configArg)
> 
>  dispatch(anotherFunc,1)
> 

The line I have underlined is returning a tuple.  So, when you do 

func = func(configArg)

It has the effect of setting 

func = (aFunc, 1)

which you then try to call.

Instead, you could try:

func, configArg = func(configArg)

Of course, you would then need to ensure that any function you could call (such
as aFunc) also returns an appropriate tuple, otherwise the unpacking will fail.
(or wrap it in an if statement or a try:except block or something)

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to