diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-10-15 12:20:03 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-10-15 12:25:49 +0200 |
| commit | 796a3459776856c30f73d166b251898cdd4cd375 (patch) | |
| tree | 9c8387b5ff45348c6aa7570e1590bd04305a4506 | |
| parent | 10d412e43fb5233b9e0105d79e3a53c2fdee4446 (diff) | |
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.
| -rwxr-xr-x | menuconfig.py | 9 |
1 files 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 |
