From 754dc96a3fd327353f449427a607ec2b7f3252e6 Mon Sep 17 00:00:00 2001 From: itamarst <> Date: Thu, 15 Oct 2020 13:53:07 +0000 Subject: [PATCH] [Imported from Trac: page Python3, version 41] --- Python3.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Python3.md b/Python3.md index e6b54c2..54c4097 100644 --- a/Python3.md +++ b/Python3.md @@ -164,4 +164,8 @@ In Python 2 a key can be bytes or unicode, and it will replace the other one. So This can lead to bugs when porting, where you end up with two keys instead of one as some strings become Unicode strings. -The interim solution will likely be dicts that enforce key type to be only bytes or only Unicode (). \ No newline at end of file +The interim solution will likely be dicts that enforce key type to be only bytes or only Unicode (). + +## Avoid massive changes + +Sometimes it's easier to be a little more lenient in input (support both unicode and bytes), or to change some type to unicode, instead of having to change hundreds of lines of code from unicode to bytes when porting. When to do so is a judgement call, but if you are changing massive amounts of code to have `b""` prefix _and_ byteness isn't important, consider alternative approaches. \ No newline at end of file