[Python-Dev] Can Python guarantee the order of keyword-only parameters? (original) (raw)

Eric Snow ericsnowcurrently at gmail.com
Mon Nov 27 19:27:20 EST 2017


On Mon, Nov 27, 2017 at 10:05 AM, Larry Hastings <larry at hastings.org> wrote:

I'd like inspect.signature to guarantee that the order of keyword-only parameters always matches the order they were declared in. Technically this isn't a language feature, it's a library feature. But making this guarantee would require that CPython internally cooperate, so it's kind of a language feature too.

Does this sound reasonable? Would it need a PEP? I'm hoping for "yes" and "no", respectively.

+1

There is definitely significant information in source code text that gets thrown away in some cases, which I'm generally in favor of preserving (see PEP 468 and PEP 520). The use case here is unclear to me, but the desired guarantee is effectively the status quo and it is a minor guarantee as well, so I don't see the harm. Furthermore, I don't see a need for a PEP given the small scale and impact.

-eric



More information about the Python-Dev mailing list