[issue21756] IDLE - ParenMatch fails to find closing paren of multi-line statements

Tal Einat report at bugs.python.org
Tue Jun 9 03:42:34 EDT 2020


Tal Einat <taleinat+python at gmail.com> added the comment:

> You solution is to add a new parameter to __init__ only used by 'flash'.  I would rather replace 'mustclose' with mode = 'tip', 'flash', or 'close'.  I believe that Stopatindex could be revised within the call.

The problem with this suggestion is that 'mustclose' is a parameter for HyperParser.get_surrounding_brackets(). When that is called, it is too late to affect whether the parsing goes beyond the end of the current line. We could add a 'mode' parameter to the HyperParser constructor, though.

Still, I don't like that approach: HyperParser is currently well encapsulated, but giving it such "modes" would tightly couple it with its current specific uses in IDLE. The approach used in the current patch, with the 'end_at_eol' parameter, preserves HyperParser's encapsulation.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue21756>
_______________________________________


More information about the Python-bugs-list mailing list