You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IDLE: Factor out similar code in editor and hyperparser #83847
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/terryjreedy'closed_at=Nonecreated_at=<Date2020-02-17.18:12:00.743>labels= ['expert-IDLE', 'type-feature', '3.9']
title='IDLE: Factor out similar code in editor and hyperparser'updated_at=<Date2020-06-13.00:09:42.603>user='https://github.com/csabella'
Under bpo-32989, there was discussion about refactoring duplicate code between hyperparser and editor.
Perhaps separate issue: the 'if use_ps1' statements in editor and hyperparser, and a couple of lines before, is nearly identical, and could be factored into a separate editor method that returns a parser instance ready for analysis. It could then be tested in isolation. The method should return a parser instance ready for analysis.
There are two levels of duplication. First, between Hyperparser and EditorWindow. Second between editor and shell branches. While I said before to resolve the first with an EditorWindow method, as done in the patch, a hyperparser function, with 'self' replaced by 'editwin' would be possible. I might prefer that.
The second level of duplication could be handled by a method in EditorWindow overridden by a method in PyShell. But with duplication between the branches removed as in the patch, leaving the Shell branch so short, this does not seem as worthwhile. I suspect/expect it would be even less so after future Shell changes.
Activity
csabella commentedon Feb 17, 2020
Under bpo-32989, there was discussion about refactoring duplicate code between hyperparser and editor.
terryjreedy commentedon Jun 10, 2020
The quote from bpo-32989 is from my msg313179, msg313179.
There are two levels of duplication. First, between Hyperparser and EditorWindow. Second between editor and shell branches. While I said before to resolve the first with an EditorWindow method, as done in the patch, a hyperparser function, with 'self' replaced by 'editwin' would be possible. I might prefer that.
The second level of duplication could be handled by a method in EditorWindow overridden by a method in PyShell. But with duplication between the branches removed as in the patch, leaving the Shell branch so short, this does not seem as worthwhile. I suspect/expect it would be even less so after future Shell changes.
csabella commentedon Jun 13, 2020
PR20847 is an implementation with the parser function in hyperparser instead of EditorWindow.