[Python-ideas] add a single __future__ for py3?

Gregory P. Smith greg at krypto.org
Mon Sep 21 19:59:54 CEST 2015

I think people should stick with *from __future__ import
absolute_import* regardless
of what code they are writing. They will eventually create a file
innocuously called something like calendar.py (the same name as a standard
library module) in the same directory as their main binary and their
debugging of the mysterious failures they just started getting from the
tarfile module will suddenly require leveling up to be able to figure it
out. ;)


On Mon, Sep 21, 2015 at 8:18 AM Guido van Rossum <guido at python.org> wrote:

> It's just about these four imports, right?
> from __future__ import absolute_import
> from __future__ import division
> from __future__ import print_function
> from __future__ import unicode_literals
> I think the case is overblown.
> - absolute_import is rarely an issue; the only thing it does (despite the
> name) is give an error message when you attempt a relative import without
> using a "." in the import. A linter can find this easily for you, and a
> little discipline plus the right example can do a lot of good here.
> - division is important.
> - print_function is important.
> - unicode_literals is useless IMO. It breaks some things (yes there are
> still APIs that don't take unicode in 2.7) and it doesn't nearly as much as
> what would be useful -- e.g. repr() and <stream>.readline() still return
> 8-bit strings. I recommend just using u-literals and abandoning Python 3.2.
> --
> --Guido van Rossum (python.org/~guido)
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150921/bd90f485/attachment.html>

More information about the Python-ideas mailing list