[Python-Dev] Deprecate `from __future__ import unicode_literals`?

Barry Warsaw barry at python.org
Fri Dec 16 16:27:34 EST 2016

On Dec 16, 2016, at 01:07 PM, Ethan Furman wrote:

>On 12/16/2016 11:24 AM, Guido van Rossum wrote:
>> I am beginning to think that `from __future__ import unicode_literals` does
>>  more harm than good. I don't recall exactly why we introduced it, but with
>>  the restoration of u"" literals in Python 3.3 we have a much better story
>>  for writing straddling code that is unicode-correct.  
>So cross-version code would be primarily 2.7 and 3.3+ ?  I can live with that.

So can I.  I don't mind "silently" deprecating it, such as adding strong
admonitions against its use in the docs, but clearly it can't be removed (at
least until 3.7) and I worry about breaking existing code, even with a more
chatty DeprecationWarning.

At least in some circles, the problems of unicode_literals are known, but it's
still useful and it's used in lots of places.  Getting rid of cruft like this
is one of the more satisfying edits when dropping Python 2 support. :)


More information about the Python-Dev mailing list