Author terry.reedy
Recipients barry, durin42, gward, ncoghlan, pitrou, r.david.murray, terry.reedy
Date 2013-03-19.22:51:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1363733481.59.0.421911370373.issue17445@psf.upfronthosting.co.za>
In-reply-to
Content
The surrogate escape approach embodies the 3.x recommendation:
decode bytes to strings, manipulate strings, encode strings to bytes.
It also makes it possible to wrap the existing context/unified_diff functions, without touching them, with a simple 12 line function. Function bytes_diff avoids the complexities of mixing and unmixing strings and bytes that remain in Greg's latest patch.

I recommend the following: replace the simple test in the attached bytes_diff.py with Greg's unittest-based tests and adjust the __name__ == '__main__' incantation accordingly. Next upload to pypi to make it available to all 3.1-3.3 users. Then, after some minimal field testing, add the utility wrapper function to 3.4 difflib.  These steps would make moot for difflib the sub-issue of whether the 3.x design is a bug fixable in bugfix releases. We could even add a reference to the pypi module in the 3.2 and 3.3 docs.
History
Date User Action Args
2013-03-19 22:51:21terry.reedysetrecipients: + terry.reedy, barry, gward, ncoghlan, pitrou, durin42, r.david.murray
2013-03-19 22:51:21terry.reedysetmessageid: <1363733481.59.0.421911370373.issue17445@psf.upfronthosting.co.za>
2013-03-19 22:51:21terry.reedylinkissue17445 messages
2013-03-19 22:51:21terry.reedycreate