Bo Peng a écrit :
Dear list,

If you ask: why do you choose these names? The answer is: they need to be conformable with other functions, parameter names.

I have a function that pretty much like:

def output(output=''):
  print output

and now in another function, I need to call output function, with again keyword parameter output

def func(output=''):
  output(output=output)

Naturally, I get 'str' object is not callable. Is there a way to tell func that the first output is actually a function? (like in C++, ::output(output) )

Thanks.
Bo

What I'd suggest is :

def func(output=''):
  gobals()["output"](output=output)

that way, the function resolution is still dynamic, but you explicitly ask for a name global and not local ...

Pierre
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to