有人知道旧版本Python(早于2.6)的 abc 实现吗?
编辑:例如,我正在寻找一个片段,它可以做与 ABCMeta 和 Abstractmethod 相同的事情,具有相同的接口,我实际上需要使一段代码向后兼容
Do someone know an implementation of abc for older versions of Python (older than 2.6) ?
EDIT : I am for example looking for a snippet that would do the same thing as ABCMeta and abstractmethod, with same interface, I actually need to make a piece of code backward compatible
发布评论
评论(1)
abc 模块本身恰好是向后兼容的。只需将 abc.py 从 2.6 复制到 pythonpath 上的某个位置即可。
The abc module itself happens to be backwards compatible. Just copy abc.py from 2.6 to somewhere on the pythonpath.