[Imported from Trac: page Python3, version 41]

itamarst 2020-10-15 13:53:07 +00:00
parent 68387e63ce
commit 754dc96a3f

@ -165,3 +165,7 @@ 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. 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 (<https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3476#ticket>). The interim solution will likely be dicts that enforce key type to be only bytes or only Unicode (<https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3476#ticket>).
## 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.