
Am 20.10.21 um 15:18 schrieb Thomas Wouters:
By and large, the SC views PEP 649 as a better way forward. If PEP 563 had never come along, it would be a fairly easy decision to accept PEP 649. We are still inclined to accept PEP 649. That would leave the consideration about what to do with PEP 563 and existing from __future__ import annotationsdirectives. As far as we can tell, there are two reasons for code to want to use PEP 563: being able to conveniently refer to names that aren’t available until later in the code (i.e. forward references), and reducing the overhead of type annotations. If PEP 649 satisfies allof the objectives of PEP 563, is there a reason to keep supporting PEP 563’s stringified annotations? Are there any practical, real uses of stringified annotations that would not be served by PEP 649's deferred annotations?
These are my reasons for using from __future__ import annotations: * Forward references and cyclic imports (with if TYPE_CHECKING: from foo import Bar) while avoiding quotes. * Using typing features from future Python versions. This becomes less important the more typing stabilizes. - Sebastian