[Python-Dev] Can Python guarantee the order of keyword-only parameters?

Nick Coghlan ncoghlan at gmail.com
Tue Nov 28 23:55:37 EST 2017

On 29 November 2017 at 03:13, Brett Cannon <brett at python.org> wrote:
> On Tue, 28 Nov 2017 at 03:33 Nick Coghlan <ncoghlan at gmail.com> wrote:
>> P.S. Note that inspect.getfullargspec() was actually undeprecated a
>> while back - enough folks that didn't need access to the function
>> annotations were reimplementing it for themselves "because the
>> standard library API is deprecated" that the most logical course of
>> action was to just declare it as being supported again. I don't think
>> that changes the argument here though - it just means guaranteed order
>> preservation in that API will only happen if we declare dicts to be
>> insertion ordered in general.
> OT for this thread, but is there an issue number tracking the
> un-deprecating? Basically I want to make sure there is an issue tracking
> deprecating it again when we stop worrying about any Python 2/3 support.

The issue is https://bugs.python.org/issue27172, but the undeprecation
isn't a Python 2/3 issue, it's a "tuples, lists and dicts are really
handy representations of things, and Python developers often prefer
them to more structured objects" issue.

The modern inspect.getfullargspec implementation is a relatively thin
wrapper around inspect.signature, and the only lossy part of the
output transformation is that you can't tell the difference between
positional-only and positional-or-keyword parameters.


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

More information about the Python-Dev mailing list