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

Matt Mackall mpm at selenic.com
Tue May 29 15:15:24 CDT 2012


On Sun, 2012-05-27 at 00:46 +0200, Angel Ezquerra wrote:
> 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.

I guess, if it's a one-liner.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list