[Python-ideas] add a single __future__ for py3?
Guido van Rossum
guido at python.org
Mon Sep 21 17:18:13 CEST 2015
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)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas