On Tue, 05 Dec 2006 22:18:02 -0800
Dick Moores <[EMAIL PROTECTED]> 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
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to