parameter name conflict. How to solve?
Bo Peng
bpeng at rice.edu
Tue Mar 8 10:26:05 EST 2005
Kent Johnson wrote:
> Bo Peng wrote:
>
>> 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) )
>
>
> You could use a default argument:
> def func(output='', output_fn=output):
> output_fn(output=output)
>
> Kent
Thank everyone for the quick responses. All methods work in general.
Since func() has to take the same parameter set as some other functins,
I can not use func(output='', output_fn=output). "output_alias=output"
etc are fine.
Bo
More information about the Python-list
mailing list