Online Absolute Beginner Python Tutorials
Every Sunday 2pm (UK time/ BST)
by Cheuk Ting Ho
Get this slide deck:
slides.com/cheukting_ho/python-type-hint
Beginner topics:
Python objects, Control flows,
Functions, modeuls, classes and decorators
strings operations and regex with re
Testing:
pytest with fixtures and mock
property-based testing
python linters & auto-formatters
TDD
Intermedite topics:
Iterators, generators, async
Packaging:
generating docs, pypi
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.
- realpython.com
def greeting(name: str) -> str:
return 'Hello ' + name
Using typing standard lib: https://docs.python.org/3/library/typing.html
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.
** Note that it's optional to use type hints
PyCharm - type is added as an annotation for Python 3
Atom - packages plug-in: linter-mypy or magicpython
VS Code - extention plug-in: pyright
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