changeset 28422:e2c6092ad422

zeroconf: replace reduce+add with itertools.chain
author timeless <timeless@mozdev.org>
date Tue, 01 Mar 2016 10:18:47 +0000
parents 6d72cc613fc4
children 0d79d91ba7e3
files hgext/zeroconf/Zeroconf.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 []