Developer advocate / Data Scientist - support open-source and building the community.
Python Zero to Heros
Online Absolute Beginner Python Tutorials
Every Sunday 2pm (UK time/ BST)
Get this slide deck:
Python objects, Control flows,
Functions, modeuls, classes and decorators
strings operations and regex with re
pytest with fixtures and mock
python linters & auto-formatters
Iterators, generators, async
generating docs, pypi
What is type hinting?
Type hinting is a formal solution to statically indicate the type of a value within your Python code. It was specified in PEP 484 and introduced in Python 3.5.
def greeting(name: str) -> str: return 'Hello ' + name
Using typing standard lib: https://docs.python.org/3/library/typing.html
Why type hinting?
Due to the dynamic nature of Python, inferring or checking the type of an object being used is especially hard.
This fact makes it hard for developers to understand what exactly is going on in code they haven't written and, most importantly, for type checking tools found in many IDEs that are limited due to the fact that they don't have any indicator of what type the objects are.
Why Type Hints?
- Helps Type Checkers
- Helps with documentation
- Helps IDEs develop more accurate and robust tools
Why use Static Type Checkers?
- Find bugs sooner
- The larger your project the more you need it
- Large teams are already running static analysis
** Note that it's optional to use type hints
Type hint with docs
Using sphinx-autodoc-typehints Sphinx extention to use Python 3 annotations for documenting acceptable argument types and return value types of functions.
Sunday 2pm (UK time/ BST)
There are also Mid Meet Py every Wednesday 1pm
Python Type Hinting
By Cheuk Ting Ho