Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:

I am not sure this is a duplicate since the other issue was about newline at 
the end of strings. This is about the diff being little irrelevant even with 
newline in the end for strings. Sample program where change in 5th character 
gives the reported diff.

import difflib

for i in range(7):
    print(f"Change character at {i}")
    a = list("drwxrwxr-x 2 2000  2000\n")
    b = "drwxrwxr-x 2 2000  2000\n"
    a[i] = '-'
    a = ''.join(a)
    print(''.join(difflib.ndiff([a], [b])))

Change character at 0
- -rwxrwxr-x 2 2000  2000
? ^
+ drwxrwxr-x 2 2000  2000
? ^

Change character at 1
- d-wxrwxr-x 2 2000  2000
?  ^
+ drwxrwxr-x 2 2000  2000
?  ^

Change character at 2
- dr-xrwxr-x 2 2000  2000
?   ^
+ drwxrwxr-x 2 2000  2000
?   ^

Change character at 3
- drw-rwxr-x 2 2000  2000
?    ^
+ drwxrwxr-x 2 2000  2000
?    ^

Change character at 4
- drwx-wxr-x 2 2000  2000
?     ^
+ drwxrwxr-x 2 2000  2000
?     ^

Change character at 5
- drwxr-xr-x 2 2000  2000
?        ---
+ drwxrwxr-x 2 2000  2000
?  +++

Change character at 6
- drwxrw-r-x 2 2000  2000
?       ^
+ drwxrwxr-x 2 2000  2000
?       ^

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35955>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to