Reverse argument order

Kirill Simonov kirill at xyz.donetsk.ua
Fri Oct 19 18:16:11 EDT 2001


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


\Xi





More information about the Python-list mailing list