fluentpython / example-code-2e

Example code for Fluent Python, 2nd edition (O'Reilly 2022)
https://amzn.to/3J48u2J
MIT License
3.17k stars 902 forks source link

Fix Tuple type hint #18

Closed PhillSimonds closed 2 years ago

PhillSimonds commented 2 years ago

The type hint for the probe async coroutine definition was 'tuple' instead of 'Tuple'. This caused python 3.8.10 to fail to compile the code.

ramalho commented 2 years ago

Thank you for raising this issue, but I will leave the code as is.

The book targets Python 3.9 and 3.10. There are numerous sections in the book focused on type hints that mention the issue of having to import Tuple from typing in older versions of Python, instead of using just tuple as Python >= 3.9 supports.

I want to encourage readers to drop the redundant imports from typing as soon as possible. They are already deprecated and will be removed in a few years.

Therefore, I will leave the code as is.