D2304: webcommands: unpack contents of length-1 dict portably
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Sun Feb 18 00:36:16 EST 2018
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
((k,v),) = dict.items() was suggested by some friends, but I feel like
that's maybe too clever?
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
@@ -542,7 +542,7 @@
emptydirs = 
h = dirs[d]
while isinstance(h, dict) and len(h) == 1:
- k, v = h.items()
+ k, v = next(iter(h.items()))
h = v
To: durin42, #hg-reviewers
More information about the Mercurial-devel