Repository navigation
Typing overhaul - #54
decorator-factory wants to merge 3 commits into
Conversation
|
One issue, though: |
I don't think this is a good idea. |
This is exactly why |
|
@elprans Am I understanding you correct that |
That's right. |
|
@elprans After playing around with this locally, I think the types need to be updated a bit more substantially than this PR addresses. I'll be submitting a new PR soon to address what I've found. |
|
@bryanforbes @elprans Thanks for the review. I guess this PR is made obsolete by #62, so I can close it? I think restricting the type of |
This PR aims to do three things:
Make use of type annotations
Before, only
_mapwas annotated, so the type checker (Pylance in my case) wasn't picking up on it. This is done usingTYPE_CHECKING, which is available since Python 3.5.2.Additional constraints when using
**kwargs:Specifically, this is wrong:
so if
**kwargsare used, the key type should be a subtype ofstrWith
dictor any other mutable mapping, this is wrong:However, with
Map, this is fine, it just produces a map of different type: