[issue35955] difflib reports incorrect location of mismatch

Tim Peters report at bugs.python.org
Mon Feb 11 15:07:41 EST 2019


Tim Peters <tim at python.org> added the comment:

It's probably OK, but there's no "pure win" to be had here.  There's generally more than one way to convert one string to another, and what "looks right" to humans depends a whole lot on context.

For example, consider these strings:

"private Thread currentThread;"
"private volatile Thread currentThread;"

"It's obvious" someone inserted "volatile" into the first string, and that's what ndiff's default says:

- private Thread currentThread;
+ private volatile Thread currentThread;
?         +++++++++

However, pass `charjunk=None` instead, and ndiff claims someone inserted "e volatil" after the "t" in "private":

- private Thread currentThread;
+ private volatile Thread currentThread;
?       +++++++++

Which is also a correct way, but - to human eyes - an insane way ;-)

----------

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


More information about the Python-bugs-list mailing list