Repository: python/cpython
Issue category: Performance Issue

Issue:
IDLE maxosc.overrideRootMenu: remove unused menudict
BPO | [33964](https://bugs.python.org/issue33964)
--- | :---
Nosy | @terryjreedy, @csabella
PRs | <li>python/cpython#7926</li>
Dependencies | <li>bpo-33963: IDLE macosx: add tests.</li>

<sup>*Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.*</sup>

<details><summary>Show more details</summary><p>

GitHub fields:
```python
assignee = 'https://github.com/terryjreedy'
closed_at = None
created_at = <Date 2018-06-26.04:01:56.869>
labels = ['expert-IDLE', '3.7', '3.8', 'performance']
title = 'IDLE maxosc.overrideRootMenu: remove unused menudict'
updated_at = <Date 2019-03-20.19:52:30.187>
user = 'https://github.com/terryjreedy'
```

bugs.python.org fields:
```python
activity = <Date 2019-03-20.19:52:30.187>
actor = 'cheryl.sabella'
assignee = 'terry.reedy'
closed = False
closed_date = None
closer = None
components = ['IDLE']
creation = <Date 2018-06-26.04:01:56.869>
creator = 'terry.reedy'
dependencies = ['33963']
files = []
hgrepos = []
issue_num = 33964
keywords = ['patch']
message_count = 2.0
messages = ['320470', '338509']
nosy_count = 2.0
nosy_names = ['terry.reedy', 'cheryl.sabella']
pr_nums = ['7926']
priority = 'normal'
resolution = None
stage = 'patch review'
status = 'open'
superseder = None
type = 'performance'
url = 'https://bugs.python.org/issue33964'
versions = ['Python 3.7', 'Python 3.8']
```

</p></details>



Hints:
Function local name 'menudict' is initialized empty, two key value pairs are added, and it is never touched again.

Patch:
diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py
index 89b645702d334d..2ea02ec04d661a 100644
--- a/Lib/idlelib/macosx.py
+++ b/Lib/idlelib/macosx.py
@@ -174,9 +174,8 @@ def overrideRootMenu(root, flist):
     del mainmenu.menudefs[-3][1][0:2]
     menubar = Menu(root)
     root.configure(menu=menubar)
-    menudict = {}
 
-    menudict['window'] = menu = Menu(menubar, name='window', tearoff=0)
+    menu = Menu(menubar, name='window', tearoff=0)
     menubar.add_cascade(label='Window', menu=menu, underline=0)
 
     def postwindowsmenu(menu=menu):
@@ -226,8 +225,7 @@ def help_dialog(event=None):
 
     if isCarbonTk():
         # for Carbon AquaTk, replace the default Tk apple menu
-        menudict['application'] = menu = Menu(menubar, name='apple',
-                                              tearoff=0)
+        menu = Menu(menubar, name='apple', tearoff=0)
         menubar.add_cascade(label='IDLE', menu=menu)
         mainmenu.menudefs.insert(0,
             ('application', [


Test patch: