Oddity with function default arguments

Heiko Wundram heikowu at ceosg.de
Sat Jun 12 11:06:58 EDT 2004


Am Samstag, 12. Juni 2004 09:05 schrieb Sheila King:
> Why isn't the default value for a printing out when I include list
> arguments?

You don't include list arguments. You just put positional arguments into a 
function call, and of course a positional argument at the position of the 
argument which has a default declared gets inserted there, that's why you 
don't see the A when you pass more than two arguments.

All remaining positional arguments (once the named positional arguments have 
been filled) get put into the list *mylist, which is commonly called *args 
(it's not a list, btw., it's a tuple), which in your case are all arguments 
behind the third.

Hope this makes this somewhat clearer...

Heiko.




More information about the Python-list mailing list