Gregory P. Smith <g...@krypto.org> added the comment:
The way I'd go about this is to support some form of periodic checkpoint in the algorithm where it checks in with code supplied by the difflib user. Traditionally that'd have been via callbacks, there might be an async style way to express that these days. Those could indicate that they want the operation to be aborted. If it is possible to estimate progress, supplying that as input to the checkpoint API would be useful. This leaves decision logic on when to abort something entirely up to the user rather than being clock based which is often not what the user wants. I'm re-titling the issue as the original patch and proposal of a timeout isn't the direction several core devs have suggested we head. ---------- nosy: +gregory.p.smith stage: -> needs patch title: Patch: add timeout to difflib SequenceMatcher ratio() and quick_ratio() -> Provide a way for potentially long runtime difflib algorithms to be aborted by the caller (and report progress?) _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue24904> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com