[IronPython] Dictionary Ordering

Michael Foord fuzzyman at voidspace.org.uk
Thu May 18 00:44:04 CEST 2006


Dino Viehland wrote:
> It's an implementation detail which may change in future versions.
>
> There's a OrderedDict in the Python cookbook though that should work w/ IP.
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/438823
>
>   
Hey - there's an even better one at :

    http://www.voidspace.org.uk/python/odict.html

:-)

I was wondering whether the ordering in IronPython was a design decision 
or a con-incidence.

We've just upgraded (downgraded ?) our unit tests from a home-brew 
system to PyUnit. Our own system ran tests in the order they were 
defined, which was just a co-incidence as it turns out - not a design 
decision on our part.

That change alone has uncovered a few issues for us, which in the long 
run is a good thing I guess.

Michael Foord
http://www.voidspace.org.uk/python/index.shtml

>
> Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)
>
> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
> Sent: Wednesday, May 17, 2006 6:36 AM
> To: Discussion of IronPython
> Subject: [IronPython] Dictionary Ordering
>
> Hello all,
>
> IronPython seems to default to have a dictionary 'ordering' based on key
> insertion order.
>
> This is nice, but differs from the CPython implementation. However the
> spec (as I'm sure you're aware) says : (from
> http://docs.python.org/lib/typesmapping.html )
>
>      Keys and values are listed in an arbitrary order which is
> non-random, varies across Python
>     implementations, and depends on the dictionary's history of
> insertions and deletions.
>
> So IronPython behaviour is well within the spec. My question is, can we
> rely on the ordered behaviour of IronPython ? (Or is it an
> implementation detail that may change in future versions ?)
>
> Michael Foord
> http://www.resolversystems.com
>
>
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>   




More information about the Ironpython-users mailing list