PEP 692: Add changing the meaning of `**kwargs` annotations to rejected ideas (#2916)
This commit is contained in:
parent
53cdf55b7d
commit
a73c0e9750
15
pep-0692.rst
15
pep-0692.rst
|
@ -589,6 +589,21 @@ overloaded::
|
|||
@overload
|
||||
def foo(**kwargs: **Book): ...
|
||||
|
||||
Changing the meaning of ``**kwargs`` annotations
|
||||
------------------------------------------------
|
||||
|
||||
One way to achieve the purpose of this PEP without any grammar
|
||||
change would be to change the meaning of ``**kwargs`` annotations,
|
||||
so that the annotations would apply to the entire ``**kwargs`` dict,
|
||||
not to individual elements. For consistency, we would have to make an
|
||||
analogous change to ``*args`` annotations.
|
||||
|
||||
This idea was discussed in a meeting of the typing community, and the
|
||||
consensus was that the change would not be worth the cost. There is no
|
||||
clear migration path, the current meaning of ``*args`` and ``**kwargs``
|
||||
annotations is well-established in the ecosystem, and type checkers
|
||||
would have to introduce new errors for code that is currently legal.
|
||||
|
||||
|
||||
References
|
||||
==========
|
||||
|
|
Loading…
Reference in New Issue