File tree Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -19,24 +19,22 @@ asserting that classes implement those interfaces.
19
19
20
20
.. code-block :: python
21
21
22
- from abc import ABCMeta, abstractmethod
23
-
24
- class Base (metaclass = ABCMeta ):
25
-
26
- @abstractmethod
27
- def method (self , a , b ):
28
- pass
29
-
30
- class Implementation (MyABC ):
31
-
32
- def method (self ):
33
- return " This shouldn't work."
34
-
35
- impl = Implementation()
22
+ >> > from abc import ABCMeta, abstractmethod
23
+ >> > class Base (metaclass = ABCMeta ):
24
+ ... @ abstractmethod
25
+ ... def method (self , a , b ):
26
+ ... pass
27
+ ...
28
+ >> > class Implementation (MyABC ):
29
+ ... def method (self ):
30
+ ... return " This shouldn't work."
31
+ ...
32
+ >> > impl = Implementation()
33
+ >> >
36
34
37
35
The equivalent code using ``interface `` produces an error indicating that
38
- the signature of `` Implementation. method`` is incompatible with that of
39
- `` Base.method ``.
36
+ the signature of our implementation method is incompatible with the
37
+ signature of our interface declaration:
40
38
41
39
.. code-block :: python
42
40
You can’t perform that action at this time.
0 commit comments