On , I learnt ...

Python 3.7 supports postponed evaluation of annotations

For example, instead of:

import _csv

def generate_report(writer: '_csv._writer'):
    pass

you can use:

from __future__ import annotations

import _csv

def generate_report(writer: _csv._writer):
    pass

and avoid using a string literal for the type annotation.

This follows on from a related TIL about how to specify type annotations for the csv module.

Related: