On Wed, Aug 30, 2017 at 2:14 PM, Jeroen Demeyer <jdeme...@cage.ugent.be> wrote: > On 2017-08-28 12:45, Nicolas M. Thiery wrote: >> >> - Are there plans to enforce the above future imports to our doctests? In >> particular unicode_literals which seems more problematic? > > > TL;DR: I do not consider it a problem that stuff breaks with "from > __future__ import unicode_literals". > > The other __future__ imports (namely absolute_import, division and > print_function) make certain code behave just like in Python 3. That's good > in any case for portability. > > unicode_literals on the other hand creates a "mixed" environment, which is > not the same as Python 2 nor the same as Python 3. With unicode_literals, > it's only string *literals* which become unicode, but other strings still > behave like plain old strings. I would say that unicode_literals does have > its uses (if you want to do text processing in unicode both in Python 2 and > in Python 3), but it's not something that should be turned on blindly.
Agreed--for certain modules it's very useful, but it harms users on Python 2 because suddenly lots of strings have the u"" prefix for some reason (that they don't understand, necessarily) and the overall experience is disruptive and not backwards compatible. I usually try to eschew the <type 'unicode'> as much as possible on Python 2 except where explicitly needed (e.g. non-ASCII text), but otherwise keep <type 'str'> as the default string type on both Python 2 and Python 3 (even though these are very different types despite having the same name ;) -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.