From 796a3459776856c30f73d166b251898cdd4cd375 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Mon, 15 Oct 2018 12:20:03 +0200 Subject: menuconfig: Simplify _sorted_menu_comment_nodes() Can use the same function for both sort keys, and the logic can be simplified a bit too. The += is deliberate, to do in-place modification. --- menuconfig.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/menuconfig.py b/menuconfig.py index fadf38a..accaf6f 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -2021,10 +2021,11 @@ def _sorted_menu_comment_nodes(cached_nodes=[]): # with the menus first if not cached_nodes: - cached_nodes += sorted(_kconf.menus, - key=lambda menu: menu.prompt[0]) - cached_nodes += sorted(_kconf.comments, - key=lambda comment: comment.prompt[0]) + def prompt_text(mc): + return mc.prompt[0] + + cached_nodes += sorted(_kconf.menus, key=prompt_text) + \ + sorted(_kconf.comments, key=prompt_text) return cached_nodes -- cgit v1.2.3