3 ms·
>> So the real complaint is that Python switched the defaults in a way that made bytes-centric code more complicated The author made it clear. The issue wasn't
by phkahler 7y ago
>> So the real complaint is that Python switched the defaults in a way that made bytes-centric code more complicated
The author made it clear. The issue wasn't just that the default changed. It was that 3.0 took away the ability to always make your choice explicit.
Changing the default would have no effect on code that was always explicit. Going over the code and making all implicit strings explicit would allow them to know when they had full coverage, and also make the code work with both 2 and 3.
With 3, any implicit had to get b added, while any string with u had to be made implicit (drop the u). You couldn't tell by looking at code if it was converted or not. At least that's how I read it.
- int_19h 7y agoThe lack of u'' in early versions of Python 3 is a valid complaint, but it's a separate one. It's also not that big of a deal in practice, because you could always write a helper function like u('foo') that would call unicode() on Python 2, and just pass the value through on Python 3. This only breaks when you need a Unicode literal with actual Unicode characters inside, which is a rare case - and should be especially rare in something like Mercurial.