[PATCH 1 of 6] sortdict: have update() accept either dict or iterable of key/value pairs

Yuya Nishihara yuya at tcha.org
Mon Mar 9 08:27:04 CDT 2015


On Mon, 9 Mar 2015 00:05:00 -0700, Ryan McElroy wrote:
> On 3/8/2015 4:56 AM, Yuya Nishihara wrote:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya at tcha.org>
> > # Date 1424267633 -32400
> > #      Wed Feb 18 22:53:53 2015 +0900
> > # Node ID 023d0f46318665e8d01fe42fb58ac1726532b4c0
> > # Parent  62c4a963489d0ff8887b1e5d2c9458d1e3384536
> > sortdict: have update() accept either dict or iterable of key/value pairs
> I'm always skeptical about making APIs accept more things -- it makes 
> the code harder to understand and change in the future. I'd prefer that 
> all callers of this function be changed to pass key-value pair 
> iterables.

I agree with you in general, but Python dict accepts both. Our sortdict should
be the same.

> > Future patches will make templater stores sorted dict in _hybrid object.
> > sortdict should be constructed from sorted list.
> English grammar nit-picking (changes in bold): "Future patches will make 
> *the *templater *store **a **sortdict *in *the *_hybrid object. *This 
> *sortdict should be constructed from *a *sorted list."

Ah, thanks.


More information about the Mercurial-devel mailing list