arguments to functions
Uwe Mayer
merkosh at hadiko.de
Sun Jun 30 22:22:15 EDT 2002
In article <Xns923DC4803F1FDcliechtigmxnet at 62.2.16.82>, cliechti at gmx.net
says...
> Uwe Mayer <merkosh at hadiko.de> wrote in
> news:MPG.178955a4fc8bfc1c989680 at news.rz.uni-karlsruhe.de:
> > I wanted to pass one named and a collection of unnamed (an arbitrary
> > number) to a function:
>
> def f(*args, **kwargs):
> print "positional args:", args
> print "keyword args:", kwargs
> if kwargs.has_attr("expected"):
> print "Expected was set to", kwargs["expected"]
>
> does that help somehow? :-)
>
> chris
yes, thanks.
I think I should rather think of "expected=None" as an initialisation
value rather than a "named parameter".
Ciao
Uwe
More information about the Python-list
mailing list