[Python-Dev] Can Python guarantee the order of keyword-only parameters? (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Tue Nov 28 06:32:30 EST 2017
- Previous message (by thread): [Python-Dev] Can Python guarantee the order of keyword-only parameters?
- Next message (by thread): [Python-Dev] Can Python guarantee the order of keyword-only parameters?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message (by thread): [Python-Dev] Can Python guarantee the order of keyword-only parameters?
- Next message (by thread): [Python-Dev] Can Python guarantee the order of keyword-only parameters?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]