zeroconf: replace reduce+add with itertools.chain
authortimeless <timeless@mozdev.org>
Tue, 01 Mar 2016 10:18:47 +0000
changeset 28422 e2c6092ad422
parent 28421 6d72cc613fc4
child 28423 0d79d91ba7e3
zeroconf: replace reduce+add with itertools.chain
hgext/zeroconf/Zeroconf.py
--- a/hgext/zeroconf/Zeroconf.py	Tue Mar 01 10:22:10 2016 +0000
+++ b/hgext/zeroconf/Zeroconf.py	Tue Mar 01 10:18:47 2016 +0000
@@ -80,6 +80,7 @@
 __email__ = "paul at scott dash murphy dot com"
 __version__ = "0.12"
 
+import itertools
 import select
 import socket
 import string
@@ -852,9 +853,8 @@
 
     def entries(self):
         """Returns a list of all entries"""
-        def add(x, y): return x + y
         try:
-            return reduce(add, self.cache.values())
+            return list(itertools.chain.from_iterable(self.cache.values()))
         except Exception:
             return []