What are the recommended type annotations?
See original GitHub issueSuppose I have this:
from munch import munchify
def gen_dict():
return munchify({'foo': 'bar', 'id': 123})
What is the recommended way to type annotate the return value of gen_dict()
? Simply munch.Munch
?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
Understanding type annotation in Python - LogRocket Blog
In this extensive post with specific examples, learn how to use Python type annotation to your advantage using the mypy library.
Read more >Type Annotation in Python | Towards Data Science
Type annotations — also known as type signatures — are used to indicate the datatypes of variables and input/outputs of functions and ...
Read more >Using Python's Type Annotations - DEV Community
Type annotations and hints are incredibly useful for teams and multi-developer Python applications. It removes most of the guesswork from ...
Read more >Pros and Cons of Type Hints - Real Python
Type hints work best in modern Pythons. Annotations were introduced in Python 3.0, and it's possible to use type comments in Python 2.7....
Read more >PEP 484 – Type Hints - Python Enhancement Proposals
It is recommended but not required that checked functions have annotations for all arguments and the return type. For a checked function, the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
See https://github.com/python/mypy/issues/6701#issuecomment-485017283v
The issue is that there’s no type hinting in the munch code (and I am unsure if we should add right now). But in the mean time you can use this stub file: