6

As some of you may know in python2.7/3.2 we'll get OrderedDict with PEP372 however one of the reason the PEP existed was because everyone did their own implementation and they were all sightly incompatible.

So which one of the 8 current implementations in the PEP is backwards compatible with the 2.7 odict from python 2.7 in a way we can start using that now and depend on 2.7 in a couple of months?

quazgar
  • 4,304
  • 2
  • 29
  • 41
Jorge Vargas
  • 6,712
  • 7
  • 32
  • 29
  • Is there any reason you can't just pull the code for OrderedDict from 2.7a4 into its own little module for now? It doesn't look terribly involved. – Callahad Mar 20 '10 at 19:10
  • I'll have to try that, however note from the PEP there is a bug with the json module in py2.6 http://bugs.python.org/issue5381 – Jorge Vargas Mar 20 '10 at 21:04

1 Answers1

3

This package (for Python 2.4 or better) claims to be "A drop-in substitute for Py2.7's new collections.OrderedDict that works in Python 2.4-2.6.", but I have not checked that claim.

Alex Martelli
  • 854,459
  • 170
  • 1,222
  • 1,395
  • ohhh I totally missed that in my search in pypi. I think I searched for odict and not ordereddict. I'm pretty sure that one is the one as it's author is the same guy from the pep. I'll test it out and confirm here. – Jorge Vargas Mar 24 '10 at 15:42