4 ms·
in Python, dicts are actually definitionally ordered, since 3.7, so this objection doesn't carry much weight. additionally, you might be interested to know tha
by ledauphin 3y ago
in Python, dicts are actually definitionally ordered, since 3.7, so this objection doesn't carry much weight.
additionally, you might be interested to know that the implementation of dicts as ordered was found to be more performant than its predecessor.
Finally, even if they were unordered, there would be no need for ordering in this proposal, which depends on unique integer keys starting at 0.
- necovek 3y agoThe fact that they are definitionally ordered does not really matter for this discussion: for all intents and purposes of this proposal, they are unordered (insertion order is pretty much arbitrary order when it comes to their use as positional arguments or kwargs). And my intent was a bit more specific: I was thinking of "sorted", so definitely my bad. For the proposed use case, either **kwargs would have to sort a subset of the dict with integer keys to map positional arguments to their, ahem, positions, and then either leave the rest as-is (or sort it altogether), or a dict would have its definition modified to keep this order as items are added. I dislike both, and I definitely hate implicit sorting happening with **.