@@ -272,7 +272,36 @@ typed dictionaries::
272
272
273
273
See :pep: `692 ` for more details.
274
274
275
- (PEP written by Franek Magiera)
275
+ (Contributed by Franek Magiera in :gh: `103629 `.)
276
+
277
+ PEP 698: Override Decorator for Static Typing
278
+ ---------------------------------------------
279
+
280
+ A new decorator :func: `typing.override ` has been added to the :mod: `typing `
281
+ module. It indicates to type checkers that the method is intended to override
282
+ a method in a superclass. This allows type checkers to catch mistakes where
283
+ a method that is intended to override something in a base class
284
+ does not in fact do so.
285
+
286
+ Example::
287
+
288
+ from typing import override
289
+
290
+ class Base:
291
+ def get_color(self) -> str:
292
+ return "blue"
293
+
294
+ class GoodChild(Base):
295
+ @override # ok: overrides Base.get_color
296
+ def get_color(self) -> str:
297
+ return "yellow"
298
+
299
+ class BadChild(Base):
300
+ @override # type checker error: does not override Base.get_color
301
+ def get_colour(self) -> str:
302
+ return "red"
303
+
304
+ (Contributed by Steven Troxler in :gh: `101561 `.)
276
305
277
306
.. _whatsnew312-pep695 :
278
307
@@ -772,11 +801,6 @@ tempfile
772
801
typing
773
802
------
774
803
775
- * Add :func: `typing.override `, an override decorator telling to static type
776
- checkers to verify that a method overrides some method or attribute of the
777
- same name on a base class, as per :pep: `698 `. (Contributed by Steven Troxler in
778
- :gh: `101564 `.)
779
-
780
804
* :func: `isinstance ` checks against
781
805
:func: `runtime-checkable protocols <typing.runtime_checkable> ` now use
782
806
:func: `inspect.getattr_static ` rather than :func: `hasattr ` to lookup whether
@@ -821,6 +845,13 @@ typing
821
845
or more members may be slower than in Python 3.11. (Contributed by Alex
822
846
Waygood in :gh: `74690 ` and :gh: `103193 `.)
823
847
848
+ * All :data: `typing.TypedDict ` and :data: `typing.NamedTuple ` classes now have the
849
+ ``__orig_bases__ `` attribute. (Contributed by Adrian Garcia Badaracco in
850
+ :gh: `103699 `.)
851
+
852
+ * Add ``frozen_default `` parameter to :func: `typing.dataclass_transform `.
853
+ (Contributed by Erik De Bonte in :gh: `99957 `.)
854
+
824
855
sys
825
856
---
826
857
0 commit comments