Ordered dict by default
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Thu Feb 5 13:10:42 EST 2009
Bryan Olson:
> A few bits fuzzy. Is the following True or False if dict is insert-ordered?
> dict(a=6, b=7) == dict(b=7, a=6)
In my odict implementation I have disallowed that syntax because if
you want to define a mydict(**kwds) function that allows a syntax
like:
mydict(a=6, b=7)
it takes a dict as argument, such dict is currently not ordered. If
built-in dicts become ordered, then that dict too may become
ordered :-)
Anyway, maybe it's good to ignore the inserting order of items when
you look for odict equality.
Bye,
bearophile
More information about the Python-list
mailing list