[Tutor] order of arguments in function
Michael Lange
klappnase at freenet.de
Wed Dec 6 11:28:35 CET 2006
On Tue, 05 Dec 2006 22:18:02 -0800
Dick Moores <rdm at rcblue.com> wrote:
> Say I have a function,
>
> def my_function(max, min=0):
> return max - min
>
> The order of arguments is counterintuitive, but it seems it can't be
> changed if I want to have a default min. Is there way to write
>
> def my_function(min=0, max):
> stuff
>
def my_function(min, max=None):
if max is None:
max = min
min = 0
# stuff
I am not sure if this is more intuitive though.
Michael
More information about the Tutor
mailing list