compatibility problem

Michael Hudson mwh at
Wed Apr 16 22:14:33 CEST 2003

chad.scherrer at (Chad Scherrer) writes:

> I'm having a compatibility problem, and I'm wondering if anyone might
> be able to point me in the right direction. I'm running some code was
> written for python 2.1, and I'd like to make it run under 2.2, so I
> can subclass built-in types. The code is about 15,000 lines, with lots
> of different classes running around, but the gist of the problem is
> finding a solution set to an equation based on input from a file.
> Python 2.1 gives the correct solution, but somehow 2.2.2 is only
> giving me a subset. Not only that, but the order is different! The
> ordering is arbitrary anyway, but I would still expect it to be
> consistent between the two.
> So I'm wondering what I should look for to make this work under 2.2.2.
> My first thought was nested scopes, but the PEP I read suggests that
> Python 2.1 gives a warning for any case that might cause a problem in
> 2.2. I don't think it could be the method resolution order, because
> object (or any built-in type) is never subclassed. Is there anything
> else I should be looking out for?

The order of elements in dict.keys() springs to mind.  That changed
2.1 -> 2.2.


  MAN:  How can I tell that the past isn't a fiction designed to
        account for the discrepancy between my immediate physical
        sensations and my state of mind?
                   -- The Hitch-Hikers Guide to the Galaxy, Episode 12

More information about the Python-list mailing list