[Zope3-dev] Re: Python 2.4 build problem

Fred Drake fdrake at gmail.com
Wed Jan 19 23:06:25 EST 2005


On Wed, 19 Jan 2005 21:34:45 -0500, Derrick Hudson
<dman at dman13.dyndns.org> wrote:
> utils.registrations() returns a 'dictionary-iterator object' in python
> 2.3 and a 'dictionary-valueiterator object' in python 2.4 and the
> order of iteration changed.

I don't know if the change in iterator type is actually responsible
change, or if there's a change in hashing something or other.  Either
way, relying on arbitrary ordering of an unordered container's
presentation is wrong.

If the object's have meaningful comparison behaviors, a list can be
made from the iterator and sorted before presentation.  Too bad we're
not requiring Python 2.4; we'd get to use the new sorted() built-in.

> I'd be curious to see if anyone has a simple and clean solution to
> this problem.  I think a unit test (instead of a doctest) would work
> better with an equality test instead of trying to ensure a
> deterministic order of the string representation.

I often feel this way.


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
Zope Corporation


More information about the Zope3-dev mailing list