|
6 | 6 | Unit tests are in test_collections.
|
7 | 7 | """
|
8 | 8 |
|
| 9 | +############ Maintenance notes ######################################### |
| 10 | +# |
| 11 | +# ABCs are different from other standard library modules in that they |
| 12 | +# specify compliance tests. In general, once an ABC has been published, |
| 13 | +# new methods (either abstract or concrete) cannot be added. |
| 14 | +# |
| 15 | +# Though classes that inherit from an ABC would automatically receive a |
| 16 | +# new mixin method, registered classes would become non-compliant and |
| 17 | +# violate the contract promised by ``isinstance(someobj, SomeABC)``. |
| 18 | +# |
| 19 | +# Though irritating, the correct procedure for adding new abstract or |
| 20 | +# mixin methods is to create a new ABC as a subclass of the previous |
| 21 | +# ABC. For example, union(), intersection(), and difference() cannot |
| 22 | +# be added to Set but could go into a new ABC that extends Set. |
| 23 | +# |
| 24 | +# Because they are so hard to change, new ABCs should have their APIs |
| 25 | +# carefully thought through prior to publication. |
| 26 | +# |
| 27 | +# Since ABCMeta only checks for the presence of methods, it is possible |
| 28 | +# to alter the signature of a method by adding optional arguments |
| 29 | +# or changing parameters names. This is still a bit dubious but at |
| 30 | +# least it won't cause isinstance() to return an incorrect result. |
| 31 | +# |
| 32 | +# |
| 33 | +####################################################################### |
| 34 | + |
9 | 35 | from abc import ABCMeta, abstractmethod
|
10 | 36 | import sys
|
11 | 37 |
|
|
0 commit comments