aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-07 02:03:12 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-07 02:03:12 +0100
commit3f4b3c3f4c0ed09dfd70f94abc78be4e10857549 (patch)
tree7c816370114d06444c7aafefc380ff999cbdb4b7 /src/util.py
parentm (diff)
downloadxpybar-3f4b3c3f4c0ed09dfd70f94abc78be4e10857549.tar.gz
xpybar-3f4b3c3f4c0ed09dfd70f94abc78be4e10857549.tar.bz2
xpybar-3f4b3c3f4c0ed09dfd70f94abc78be4e10857549.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/util.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util.py b/src/util.py
index d42515b..ef7cd52 100644
--- a/src/util.py
+++ b/src/util.py
@@ -95,10 +95,10 @@ def reduce(f, items):
@param f:(¿E?, ¿E?)→¿E? The function
@param item:itr<¿E?> The input
- @return ¿E? The output
+ @return ¿E?? The output, `None` if `item` is empty
'''
- if len(items) < 2:
- return [] if len(items) == 0 else items[0]
+ if len(items) == 0:
+ return None
rc = items[0]
for i in range(1, len(items)):
rc = f(rc, items[i])