File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ initialized within the class. Mypy infers the types of attributes:
20
20
a.y = 3 # Error: A has no attribute y
21
21
22
22
This is a bit like each class having an implicitly defined
23
- ``__slots__ `` attribute. In Python semantics this is only enforced
24
- during type checking: at runtime we use standard Python semantics .
23
+ ``__slots__ `` attribute. This is only enforced during type
24
+ checking and not when your program is running .
25
25
26
26
You can declare types of variables in the class body explicitly using
27
27
a type comment:
@@ -93,11 +93,11 @@ override has a compatible signature:
93
93
You can also override a statically typed method with a dynamically
94
94
typed one. This allows dynamically typed code to override methods
95
95
defined in library classes without worrying about their type
96
- signatures, similar to Python .
96
+ signatures.
97
97
98
98
There is no runtime enforcement that the method override returns a
99
- value that is compatible with the original return type, since types
100
- are erased in the Python semantics :
99
+ value that is compatible with the original return type, since
100
+ annotations have no effect at runtime :
101
101
102
102
.. code-block :: python
103
103
You can’t perform that action at this time.
0 commit comments