[Python-ideas] deferred default arguments

Nick Coghlan ncoghlan at gmail.com
Fri Jul 15 06:38:47 CEST 2011


On Thu, Jul 14, 2011 at 11:23 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> That's not to say that DRY violations in function signatures aren't a real
> problem -- I've run into them myself. But I question how large a problem
> they are, in practice. Language support solving them seems to me to be a
> case of using a sledgehammer to crack a peanut. DRY is mostly a problem for
> implementation, not interface: implementation should remain free to change
> rapidly, and so repeating yourself makes that harder. But interface (e.g.
> your library API, including function signatures) should be static for long
> periods of time, so redundancy in function signatures is less important.

+1

A PEP 362 based answer would likely involve assigning to __signature__
on the wrapping function and making good use of Signature.bind()
inside it. There are also much bigger problems that PEP 362 will let
us solve (e.g. decent introspection of builtin functions, and
functions that use pass-through *args and **kwds).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list