typing
typing copied to clipboard
TypedDict with patterns as key names
I'm not sure if I should open an issue here at typing, please let me know if there is something better.
WSGI type defines. https://gist.github.com/abersheeran/f3723029387fe7f6584c6b157b90a50a
When writing a more static WSGI definition based on PEP3333, I discovered such a problem. TypedDict cannot describe the HTTP_* keys in the WSGI specification. I know that one of the original intentions of TypedDict is to prevent typing the wrong keys. But can we add an option (for example: allow_undefined=True) to allow this actual problem?
Can you bring this idea up on typing-sig?
Sorry, I don't quite understand what you mean, can you elaborate more?
@abersheeran Guido is referring to the typing-sig mailing list, which you can sign up for at https://mail.python.org/mailman3/lists/typing-sig.python.org/.
@abersheeran Guido is referring to the typing-sig mailing list, which you can sign up for at https://mail.python.org/mailman3/lists/typing-sig.python.org/.
Thanks for your explanation.
Related discussion:https://mail.python.org/archives/list/[email protected]/thread/LMZAPV5THQV6MXXO43RMGRRPFJ7TGYQN/
I found two old issue about this. https://github.com/python/mypy/issues/7654 https://github.com/python/mypy/issues/4617
What is the progress / status of this? I would find it extremely useful.
There is no active work I'm aware of in this area. If you want to move it forward, you'll have to build support among the typing community and eventually write a PEP.