3 ms·
But that makes things worse, because you have two different versions, one of which you can't see directly. b'' is the same as '' in Python 2 in the same way u''
by x1798DE 10y ago
But that makes things worse, because you have two different versions, one of which you can't see directly. b'' is the same as '' in Python 2 in the same way u'' is the same as '' in Python 3.
Since this transformation only has any effect on Python 3, it doesn't matter if you apply it in both 2 and 3.
- klibertp 10y agoBy "this transformation" you mean manually going through the whole hg code base and inserting "b" characters before most string literals. Even if you are 100% sure that semantically `b""` and `""` in 2.7 (let's forget about <2.7 for a moment) don't differ, you cannot be sure that the transformation itself - i.e., editing the source files - won't break something. You have two ways of doing this: either manually, where you risk human error, or by writing a tool, where you risk missing certain cases. In both cases, your perfectly good Py2 code base breaks for no good reason. Moreover, even if you create a tool for applying the transformation (actually, it looks like even this loader could be used for this) to the source, once you run it and commit (imagine the commit diff and its review process!), you can't run it again if you discover your tool missed something (so iterating and improving the tool becomes harder). With the solution described in the article, you have 100% guarantee that nothing breaks on Py2 and simultaneously you can work on improving the tool. Once they're satisfied with the tool performance and the Py3 porting is more advanced, they can use it to convert the source files. IMHO that's a really sane strategy here.