On Tue, Sep 25, 2018 at 8:32 AM Anders Hovmöller <bo...@killingar.net>
wrote:

> > I'm still not sure why all this focus on new syntax or convoluted IDE
> enhancements. I presented a very simple utility function that accomplishes
> exactly the started goal of DRY in keyword arguments.
>
> And I’ve already stated my reasons for rejecting this specific solution,
> but I’ll repeat them for onlookers:
>
> 1. Huge performance penalty
>

Huh? Have you actually benchmarked this is some way?!  A couple lookups
into the namespace are really not pricey operations.  The cost is
definitely more than zero, but for any function that does anything even
slightly costly, the lookups would be barely in the noise.


> 2. Rather verbose, so somewhat fails on the stated goal of improving
> readability
>

The "verbose" idea I propose is 3-4 characters more, per function call,
than your `fun(a, b, *, this, that)` proposal.  It will actually be shorter
than your newer `fun(a, b, =this, =that)` proposal once you use 4 or more
keyword arguments.


> 3. Tooling* falls down very hard on this
>

It's true that tooling doesn't currently support my hypothetical function.
It also does not support your hypothetical syntax.  It would be *somewhat
easier* to add special support for a function with a special name like
`use()` than for new syntax.  But obviously that varies by which tool and
what purpose it is accomplishing.

Of course, PyCharm and MyPy and PyLint aren't going to bother special
casing a `use()` function unless or until it is widely used and/or part of
the builtins or standard library.  I don't actually advocate for such
inclusion, but I wouldn't be stridently against that since it's just
another function name, nothing really special.

-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to