Re: parameter name conflict. How to solve?

2005-03-08 Thread Daniel Dittmar
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) ) output_alias = output def func (output=''): output_alias(output=output) Daniel

Re: parameter name conflict. How to solve?

2005-03-08 Thread Pierre Barbier de Reuille
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,

Re: parameter name conflict. How to solve?

2005-03-08 Thread Bo Peng
Delaney, Timothy C (Timothy) wrote: Is this a style guide thing? Why not just: def func(output_param=''): output(output=output_param) This is exactly the problem. There are a bunch of other functions that use output='' parameter. Changing parameter name for this single function may cause

Re: parameter name conflict. How to solve?

2005-03-08 Thread Bo Peng
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='',

Re: parameter name conflict. How to solve?

2005-03-08 Thread Duncan Booth
Bo Peng wrote: 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. One suggestion that I haven't seen so far: Where

Re: parameter name conflict. How to solve?

2005-03-08 Thread Greg Ewing
Bo Peng wrote: def func(output=''): output(output=output) Another solution that hasn't been mentioned yet: def func(**kwds): output(output = kwds['output']) You might want to do some more checking on the contents of kwds to make sure it doesn't contain any other nonsense parameters. --

RE: parameter name conflict. How to solve?

2005-03-08 Thread Delaney, Timothy C (Timothy)
Bo Peng wrote: Is this a style guide thing? Why not just: def func(output_param=''): output(output=output_param) This is exactly the problem. There are a bunch of other functions that use output='' parameter. Changing parameter name for this single function may cause confusion.

parameter name conflict. How to solve?

2005-03-07 Thread Bo Peng
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

Re: parameter name conflict. How to solve?

2005-03-07 Thread Steven Bethard
Bo Peng wrote: 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

RE: parameter name conflict. How to solve?

2005-03-07 Thread Delaney, Timothy C (Timothy)
Steven Bethard wrote: If you ask: why do you choose these names? The answer is: they need to be conformable with other functions, parameter names. Is this a style guide thing? I have a function that pretty much like: def output(output=''): print output and now in another function, I