Reverse argument order

Bengt Richter bokr at accessone.com
Sat Oct 20 18:01:43 EDT 2001


On Sat, 20 Oct 2001 01:16:11 +0300, Kirill Simonov <kirill at xyz.donetsk.ua> wrote:

>On Fri, Oct 19, 2001 at 02:59:19PM -0700, David Brady wrote:
>> P.S. We're going to go with the "while len(args)<3:
>> args.insert(0,0)" model for now.  Much less sucky,
>> yes, thanks!
>
>How about such solution?
>
>>>> def Wait(*args):
>...     h, m, s = ((0, 0, 0) + args)[-3:]
>...     print h, m, s
>...
>>>> Wait()
>0 0 0
>>>> Wait(1)
>0 0 1
>>>> Wait(1, 2)
>0 1 2
>>>> Wait(1, 2, 3)
>1 2 3
>
Nicer than brute force ;-)




More information about the Python-list mailing list