Try to import Python's OrderedDict

There is an OrderedDict in Python 2.7+.
The try order is now as follows:
* OrderedDict from Python's collections module
* OrderedDict from the jsonencode module (dependency)
* OrderedDict from the ordereddict module (pypi package)
* our own OrderedDict
This commit is contained in:
Laurent Bachelier 2011-04-23 23:44:45 +02:00
commit 5ac2de43d7

View file

@ -19,9 +19,15 @@
try: try:
from collections import OrderedDict
except ImportError:
try:
from simplejson import OrderedDict
except ImportError:
try:
from ordereddict import OrderedDict from ordereddict import OrderedDict
except: except ImportError:
## {{{ http://code.activestate.com/recipes/576693/ (r6) ## {{{ http://code.activestate.com/recipes/576693/ (r6)
from UserDict import DictMixin from UserDict import DictMixin
@ -123,4 +129,4 @@ except:
def __ne__(self, other): def __ne__(self, other):
return not self == other return not self == other
## end of http://code.activestate.com/recipes/576693/ }}} ## end of http://code.activestate.com/recipes/576693/ }}}