[Python-Dev] Keyword-only parameters

Paul Sokolovsky pmiscml at gmail.com
Tue Apr 14 22:23:17 CEST 2015


Hello,

On Tue, 14 Apr 2015 15:40:32 -0400
Larry Hastings <larry at hastings.org> wrote:

> On 04/14/2015 01:56 PM, Paul Sokolovsky wrote:
> > But newer parts of stdlib, e.g. asyncio, visibly overuse kw-only
> > args.
> 
> Overuse?  asyncio?  You mean "that thing Guido just wrote last
> year"? The most practical definition I've heard for the word
> "pythonic" is "code like Guido writes".

You probably read that sentence too fast, so let's clarify it up:

1. asyncio project, previously known as "tulip" is some 2.5 years old,
prooflink:
https://github.com/python/asyncio/commit/0b0da72d0d23a4c582ea07dd3d2638021183750e .
The fact that people still don't know it well enough (e.g. that it's
full of kw-only args, or that it's so old) is sad.

2. asyncio has >1 function which accepts just couple of arguments,
one of the arguments being forced as keyword-only. There can be
multiple opinions of how to treat such usage of kw-only arguments, and
one of the opinions can be summarized as "overuse of kw-only arguments".


And to state the obvious, Python had keyword arguments for ages, and
people used them all this time. The talk now is to *force* people to
use keyword arguments. Done right (as supposedly asyncio tries to do,
actual results may vary), it's good. But if it suddenly goes as a
fashion to make kw-only args *everywhere*, that can only lead to harder
to type and noisier to read code. So yes, people better err on the side
of not forcing them as such, leaving choice to the actual users. 
 

> //arry/



-- 
Best regards,
 Paul                          mailto:pmiscml at gmail.com


More information about the Python-Dev mailing list