diff --git a/README.md b/README.md index 4496575..5031fd1 100644 --- a/README.md +++ b/README.md @@ -1023,13 +1023,12 @@ class C(A, B): pass ### Type Annotations * **They add type hints to variables, arguments and functions (`'def f() -> :'`).** -* **Are ignored by CPython interpreter, but used by tools such as [mypy](https://pypi.org/project/mypy/), [Pydantic](https://pypi.org/project/pydantic/) and [Cython](https://pypi.org/project/Cython/).** +* **Hints are used by type checkers like [mypy](https://pypi.org/project/mypy/), data validation libraries such as [Pydantic](https://pypi.org/project/pydantic/) and lately also by [Cython](https://pypi.org/project/Cython/) compiler. However, they are not enforced by CPython interpreter.** ```python from collections import abc : [| ...] [= ] -: list/set[] [= ] -: abc.Iterable/abc.Sequence[] [= ] +: list/set/abc.Iterable/abc.Sequence[] [= ] : dict/tuple[, ...] [= ] ``` diff --git a/index.html b/index.html index 00a550a..f2849e4 100644 --- a/index.html +++ b/index.html @@ -862,12 +862,11 @@ Z = dataclasses.make_dataclass('Z', [

Type Annotations

  • They add type hints to variables, arguments and functions ('def f() -> <type>:').
  • -
  • Are ignored by CPython interpreter, but used by tools such as mypy, Pydantic and Cython.
  • +
  • Hints are used by type checkers like mypy, data validation libraries such as Pydantic and lately also by Cython compiler. However, they are not enforced by CPython interpreter.
from collections import abc
 
 <name>: <type> [| ...] [= <obj>]
-<name>: list/set[<type>] [= <obj>]
-<name>: abc.Iterable/abc.Sequence[<type>] [= <obj>]
+<name>: list/set/abc.Iterable/abc.Sequence[<type>] [= <obj>]
 <name>: dict/tuple[<type>, ...] [= <obj>]
 
diff --git a/pdf/remove_links.py b/pdf/remove_links.py index 95fd913..bb47338 100755 --- a/pdf/remove_links.py +++ b/pdf/remove_links.py @@ -11,6 +11,7 @@ MATCHES = { 'Module operator provides functions itemgetter() and mul() that offer the same functionality as lambda expressions above.': 'Module \'operator\' (p. 31) provides functions itemgetter() and mul() that offer the same functionality as lambda expressions (p. 11) above.', 'Adding \'!r\' to the expression converts object to string by calling its repr() method.': 'Adding \'!r\' to the expression converts object to string by calling its repr() method.', 'It can be any callable, but is usually implemented as a function that returns a closure.': 'It can be any callable, but is usually implemented as a function that returns a closure.', + 'Hints are used by type checkers like mypy, data validation libraries such as Pydantic and lately also by Cython compiler. However, they are not enforced by CPython interpreter.': 'Hints are used by type checkers like mypy, data validation libraries such as Pydantic and lately also by Cython compiler. However, they are not enforced by CPython interpreter.', 'Objects can be made sortable with \'order=True\' and immutable with \'frozen=True\'.': 'Objects can be made sortable with \'order=True\' and immutable with \'frozen=True\'.', 'For object to be hashable, all attributes must be hashable and \'frozen\' must be True.': 'For object to be hashable, all attributes must be hashable and \'frozen\' must be True.', 'Function field() is needed because \'<attr_name>: list = []\' would make a list that is shared among all instances. Its \'default_factory\' argument can be any callable.': 'Function field() is needed because \'<attr_name>: list = []\' would make a list that is shared among all instances. Its \'default_factory\' argument can be any callable (p. 17).', @@ -25,7 +26,7 @@ MATCHES = { 'An object with the same interface called ProcessPoolExecutor provides true parallelism by running a separate interpreter in each process. Arguments/results must be pickable.': 'An object with the same interface called ProcessPoolExecutor provides true parallelism by running a separate interpreter in each process. Arguments/results must be pickable.', 'ProcessPoolExecutor provides true parallelism, but everything sent to/from workers must be pickable. Queues must be sent using executor\'s \'initargs\' and \'initializer\' parameters.': 'ProcessPoolExecutor provides true parallelism, but everything sent to/from workers must be pickable. Queues must be sent using executor\'s \'initargs\' and \'initializer\' parameters.', 'Asyncio module also provides its own Queue, Event, Lock and Semaphore classes.': 'Asyncio module also provides its own Queue, Event, Lock and Semaphore classes (p. 30).', - 'A WSGI server like Waitress and a HTTP server such as Nginx are needed to run globally.': 'A WSGI server like Waitress and a HTTP server such as Nginx are needed to run globally.', + 'Install a WSGI server like Waitress and a HTTP server such as Nginx for better security.': 'Install a WSGI server like Waitress and a HTTP server such as Nginx for better security.', 'The "latest and greatest" profiler that can also monitor GPU usage is called Scalene.': 'The "latest and greatest" profiler that can also monitor GPU usage is called Scalene.', }