[issue19111] 2to3 should remove from future_builtins import *

Kevin Christopher Henry report at bugs.python.org
Mon Sep 22 05:09:17 CEST 2014


Kevin Christopher Henry added the comment:

I'm interested in working on this, but it's not clear to me if this has been accepted as a bug. I converted a large project recently and was shocked to find that all 100+ files were broken because of the needless "from future_builtins..." line. Perversely, this most hurts those who made the most effort to make their code forward-compatible with Python 3.

One complication is that you can't simply substitute a blank line, since that could produce invalid code if the import is inside a try/except block. (This doesn't affect "from __future__..." since that can only be at the start of a file.) Substituting a "pass" should work fine though. That would be a bit unsightly, but then again so is the blank line at the start of the file produced by removing "from __future__...". More important is to produce code that actually works under Python 3.

Another issue is that it's possible to simply "import future_builtins" and then use, for example, "future_builtins.zip(...)". So trying to fix that usage as well would be (I assume) a lot more complicated. Personally it seems fine with me to just fix the "from __future_builtins__..." usage.

----------
nosy: +marfire
versions: +Python 3.5 -Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19111>
_______________________________________


More information about the Python-bugs-list mailing list