Martin v. Löwis wrote:
> One reason I see is to have keyword-only functions, i.e. with no
> positional arguments at all:
> 
> def make_person(*, name, age, phone, location):
>     pass
> 
> which also works for methods:
> 
>     def make_person(self, *, name, age, phone, location):
>         pass
> 
> In these cases, you don't *want* name, age to be passed in a positional
> way. How else would you formulate that if this syntax wasn't available?

But is it necessary to syntactically *enforce* that the arguments be 
used as keywords?  I.e., why not just document that the arguments should 
be used as keyword arguments, and leave it at that.  If users insist on 
using them positionally, then their code will be less readable, and 
might break if you decide to change the order of the parameters, but 
we're all consenting adults.  (And if you *do* believe that the 
parameters should all be passed as keywords, then I don't see any reason 
why you'd ever be motivated to change their order.)

-Edward

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to