[chirp_devel] [PATCH] Fix bad lambda conversion in platform.py (#2355)

Zach Welch
Sat Feb 28 18:36:24 PST 2015


# HG changeset patch
# User Zach Welch <zach at mandolincreekfarm.com>
# Fake Node ID 0950b87f067d66c08454421ce5ecd89735bbbe6c

Fix bad lambda conversion in platform.py (#2355)

... and today I learned that python's lambda expressions have an
implicit "return" statement, while defs don't.

diff --git a/chirp/platform.py b/chirp/platform.py
index d09240b..fc142c8 100644
--- a/chirp/platform.py
+++ b/chirp/platform.py
@@ -58,10 +58,10 @@ def _find_me():
 
 def natural_sorted(l):
     def convert(text):
-        int(text) if text.isdigit() else text.lower()
+        return int(text) if text.isdigit() else text.lower()
 
     def natural_key(key):
-        [convert(c) for c in re.split('([0-9]+)', key)]
+        return [convert(c) for c in re.split('([0-9]+)', key)]
 
     return sorted(l, key=natural_key)
 




More information about the chirp_devel mailing list