[issue23184] Unused imports, variables, file in IDLE

Al Sweigart report at bugs.python.org
Fri Jan 9 06:45:41 CET 2015


Al Sweigart added the comment:

I've updated the patch.

I've removed the EditorWindow deletion. Importing that and using it as a class variable instead of using an assignment statement wasn't picked up. (Is there a more opaque way to do this import?)

I've left the RemoteDebugger.py change in. The frame variable name is (confusingly) reused:

        frame = frametable[fid]
        # ...cut for brevity...
        stack, i = self.idb.get_stack(frame, tb)
        stack = [(wrap_frame(frame), k) for frame, k in stack]

Changed to:

        # ...cut for brevity...
        stack, i = self.idb.get_stack(frametable[fid], tb)
        stack = [(wrap_frame(frame), k) for frame, k in stack]


The first use of frame is eliminated by simply using frametable[fid] instead. The second use is as the temporary variable inside the list comprehension, which means the "frame" name is reused. With this change, the only time the frame local variable is used is in the list comprehension. This gets rid of the name reuse and makes it a bit simpler.

----------
Added file: http://bugs.python.org/file37651/idle_unused_patch2.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23184>
_______________________________________


More information about the Python-bugs-list mailing list