Would a Python 2.8 help you port to Python 3?
On Tue, Jun 3, 2014 at 10:40 PM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> An interesting article from Lennart Regebro
> although I'm inclined to ignore it as it appears to be factual. We can't
> have that getting in the way of plain, good, old fashioned FUD now can we?
One point I'd add to that blog post.
import ConfigParser as configparser
from six.moves import configparser
The theoretical Python 2.8 version isn't shown, but presumably it would be:
If you want this sort of thing, there's nothing stopping you from
creating a configparser.py that just says "from ConfigParser import *"
and writing Python 3 code. If it really is that simple, and in a
number of cases it is, the hassle isn't great. (I've written
straddling code without six's help, just by looking at the
before-and-after of 2to3 - on the file I'm looking at now, that's two
imports that got renamed, plus "FileNotFoundError=OSError" for Python
2. Sure, I could cut that down a bit in length using six, but for just
three cases, it's not a big deal.)
Really, if the Py2 vs Py3 complaints are about module renamings, there
are so many easy solutions that it's almost laughable. There are other
changes that are slightly less small (the blog mentions metaclasses,
for instance), but all can be solved. The real problem - the reason
that big codebases can't be migrated with a few simple changes at the
tops of files or simple direct translations - is str->bytes/unicode,
because that one forces the programmers to actually think about what
they're doing. And there is nothing, absolutely nothing, that Python
2.8 can ever do to help with that.