I am trying to use Abstract Base Classes in Python 2.5 (http://docs.python.org/library/abc.html). However, this feature is new in Python 2.6. Can I just copy the source file abc.py into my pythonpath and have everything work properly? If not, how else would I get abstract base classes in Python 2.5?
I am trying to use Abstract Base Classes in Python 2.5 ( http://docs.python.org/library/abc.html ).
Share
You can copy the abc.py module from Python2.6. It has no dependencies and does not use any features specific to Python 2.6.
The Python 2.7 source is more complicated with a dependency on WeakRefSet.
In addition to copying abc.py, you may what to create versions of isinstance and issubclass functions that are abc-aware.