config.sortdict.keys() does not return the list of keys in order

Angel Ezquerra angel.ezquerra at gmail.com
Sat May 26 17:46:54 CDT 2012


Hi,

I was looking at the code for the config.sortdict() class and I was a
bit surprised to see that it does not override the "keys" method to
simply return its internal _list property. This would return the list
of keys in order (as it already does as you iterate over the
sortdict).

I think it would make sense to do so, but I worry that this may be
done in purpose? Maybe it would be worse performance wise? If this is
not done on purpse I could send a patch which fixes this.

BTW, I found this out when I tried to use config.sortdict() in some
new TortoiseHg code. I needed an ordered dict and rather than making
my own I thought it would be a good idea to use the one that is
provided by mercurial.

Cheers,

Angel


More information about the Mercurial-devel mailing list