Reverse argument order

Skip Montanaro skip at pobox.com
Fri Oct 19 16:43:56 EDT 2001


    >> Is it possible to do something like this in Python, to
    >> reverse the argument order?   I came up with the
    >> following, but I wonder if I'm going about it the hard
    >> way.

    Sean> is requiring settime(0,0,5) too much to ask?  It is analogous to
    Sean> 00:00:05 which we are all used to seeing on our microwaves.

Even better, why not define settime like so:

    def settime(hours=0, minutes=0, seconds=0):
        ...

and call it as any of

    settime(seconds=5)
    settime(hours=1, seconds=10)
    settime(1,10,10)
    settime(0,0,5)
    ...

?

-- 
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list