提交 55d77af2 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

fake abstract base class for python2.4

上级 5ec2e913
# From http://code.activestate.com/recipes/576694/ # From http://code.activestate.com/recipes/576694/
import collections
KEY, PREV, NEXT = range(3) KEY, PREV, NEXT = range(3)
class OrderedSet(collections.MutableSet): try:
from collections import MutableSet
except ImportError:
# Python 2.4
MutableSet = object
class OrderedSet(MutableSet):
def update(self, container): def update(self, container):
# only allowed ordered containers # only allowed ordered containers
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论