On Thu, March 2, 2006 3:55 pm, Ben Vinger wrote:
> Hello
>
> I want myfunction in the pseudocode below return something different if it
> was called from indexfunction.

I'm new to this but maybe it would be good if you passed the appropriate
"version" of "myfunction" to indexfunction from where the original
decision of which one to use was made rather than doing it at the lower
levels.

Something like.

def myfunwithheaders(x):
  return header + x + footer

def myfunwithoutheaders(x):
  return x

def main():
   blah
   if needheaders:
    myfunction(myfunwithheaders)
   else:
    myfunction(myfunwithoutheaders)

def myfunction(ret):
   x = "whatever"
   return ret(x)

I'd appreciate if some of the more experienced folks on the list comment
on the general approach.

Thanks much.

-- 
-NI

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

Reply via email to