This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cheryl.sabella
Recipients cheryl.sabella, terry.reedy
Date 2018-03-05.00:34:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1520210044.35.0.467229070634.issue32989@psf.upfronthosting.co.za>
In-reply-to
Content
> In the meanwhile, to get some idea of how well find_good_parse_start finds good parse starts, I restarted IDLE in a console with the print still added, loaded editor.py, and hit RETURN followed by UNDO, in various places. The first non-zero bod, 812, comes with the cursor at the end of 'def _sphinx_version():'  812 is probably the beginning of the line.  After "if __name__ == '__main__':" near the end, 1416.  After the final "run(_editor_window)", 1654.  The highest value I got in about 10 tries past the middle, 1931.  To me, this is pathetically bad.

Print `startat` too.  `num_context_lines` isn't CodeContext (although I thought it was too); that's just unfortunate naming.  `num_context_lines` is just a list = [50, 500, 5000]. First it looks at the code going back 50 lines from the current line and it only sends the text to `find_good_parse_start()` from this line onward.  `bod` is calculated from that point, not from the beginning of the file.  Because the start point is always 50 lines back, `bod` seems to always be in a similar range once you get to line 50 or higher in the code.

It seems that the purpose of the parsing is to apply the translate, etc to as few lines as possible.  So, it tries to make sure it includes the openers (':' ending lines) and closers (return, pass, etc) and the beginning of the brackets and continuation lines.  The big thing is that it wants to make sure it's not in a string or comment.  So, I think the program almost overcompensates for the idea of a 'large string'.  It is very complex and very hard to figure out exactly what it is trying to accomplish, even with the comments.  Maybe modern computing power (compared to 2000) has made it such that translating a whole source file is quick enough to not need fancy parsing.  :-)
History
Date User Action Args
2018-03-05 00:34:04cheryl.sabellasetrecipients: + cheryl.sabella, terry.reedy
2018-03-05 00:34:04cheryl.sabellasetmessageid: <1520210044.35.0.467229070634.issue32989@psf.upfronthosting.co.za>
2018-03-05 00:34:04cheryl.sabellalinkissue32989 messages
2018-03-05 00:34:04cheryl.sabellacreate