Curiosity question on signatures

midtoad stewart at midtoad.homelinux.org
Sat Mar 6 04:29:17 CET 2004


Gonçalo Rodrigues wrote:

> Does this "feature" of being able to treat positional arguments as
> named arguments have any use? Does anybody make any use of it? Is
> there any rationale on why it's in the language?

Oi Gonçalo, tudo bem?

my reference Python Web Programming by Steve Holden has a good section on
functions and arguments.   He would likely say in response to your post
that in your example you are not using positional arguments as named
arguments. Rather, you are providing arguments as keywords.   Python
doesn't restrict you unnecessarily, so you can provide the arguments in the
way that you prefer.   One restriction however does exist: all the
positional arguments have to come before the keyword arguments; that's
because you may a case with a variable number of keyword arguments, so they
have to come at the end. 

Stewart




More information about the Python-list mailing list