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

Brett Cannon brett at python.org
Tue Nov 28 12:13:50 EST 2017


On Tue, 28 Nov 2017 at 03:33 Nick Coghlan <ncoghlan at gmail.com> wrote:

> On 28 November 2017 at 15:42, Larry Hastings <larry at hastings.org> wrote:
> > On 11/27/2017 03:58 PM, Yury Selivanov wrote:
> >> We can't say anything about the order if someone passes a partial
> >> object
> >
> > Sure we could.  We could ensure that functools.partial behaves in a sane
> > way, then document and guarantee that behavior.
>
> Right, I think the main implication here would be that we need to
> ensure that any signature manipulation operations *we* provide are
> order preserving.
>
> Fortunately for Larry, we kinda cheat on that front: all the logic for
> dealing with this problem is in the inspect module itself, which knows
> about all the different ways we manipulate signatures in the standard
> library. That means that if we want to declare that the inspect module
> will be order preserving, we can, and it shouldn't require changes to
> anything else.
>
> Cheers,
> Nick.
>
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171128/0f9059ec/attachment.html>


More information about the Python-Dev mailing list