Most languages run dynamically and can point to just a few syntax errors. Yet almost most of the errors which programmers face are probably type errors or run time errors. This is where the need for static code analysis comes from.
In the Python world, the standard library comes with typing modules and type hints. Python types are implemented as a series of PEP(Python enhancement proposals) and in the latest python version i.e. 3.9 it provides run time support for Python typing which doesn’t require importing typing every time. With the latest PEP for type hinting generics in standard collections, you can now use built-in collection types such as list and dict as generic types instead of importing the corresponding typing module.
def greet_all(names: list[str]) -> None: for name in names: print("Hello", name)
Check out more in the below links 👇:
Three Links for this week 👉:
- Arya provides tips about Understanding your parents and making them aware of your decisions
- TalkPython host, Michael Kennedy, and Eugene have a slightly more philosophical chat on the latest episode where they discussed about life lessons from machine learning
- Susanshu encourages us to say yes to more scary decisions