
5 Mar
2019
5 Mar
'19
1:56 a.m.
On 3/4/19 10:44 AM, Steven D'Aprano wrote:
If you know ahead of time which order you want, you can simply reverse it:
# prefs = site_defaults + user_defaults + document_prefs prefs = dict(ChainMap(document_prefs, user_defaults, site_defaults))
but that seems a little awkward to me, and reads backwards. I'm used to thinking reading left-to-right, not right-to-left.
I read that as use document preferences first, then user defaults, then site defautls, exactly as I'd explain the functionality to someone else.
So maybe we're agreeing: if you think in terms of updating a dictionary of preferences, then maybe it reads backwards, but if you think of implementing features, then adding dictionaries of preferences reads backwards.