Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.06; 'great.': 0.07; 'importerror:': 0.07; 'subject:help': 0.08; '2to3': 0.09; 'lawrence': 0.09; 'mentions': 0.09; 'sure,': 0.09; 'translations': 0.09; 'try:': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'changes': 0.15; '"from': 0.16; 'be:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'imports': 0.16; 'inclined': 0.16; 'subject:port': 0.16; 'ignore': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'bit': 0.19; 'module': 0.19; 'slightly': 0.19; 'written': 0.21; '(the': 0.22; 'appears': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'stopping': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; 'that.': 0.31; 'forces': 0.31; 'post.': 0.31; 'really,': 0.31; 'url:06': 0.31; 'file': 0.32; 'says': 0.33; 'cases': 0.33; 'programmers': 0.33; "i'd": 0.34; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'except': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'version': 0.36; 'really': 0.36; 'subject:?': 0.36; 'two': 0.37; 'files': 0.38; 'pm,': 0.38; 'help,': 0.39; 'easy': 0.60; 'simple,': 0.60; 'length': 0.61; 'simple': 0.61; 'real': 0.63; 'direct': 0.67; 'cut': 0.74; 'theoretical': 0.74; 'article': 0.77; 'url:wordpress': 0.78; '2.8': 0.84; 'configparser': 0.84; 'hassle': 0.84; 'presumably': 0.84; 'url:03': 0.84; 'url:2014': 0.84; 'we?': 0.84; 'absolutely': 0.87; 'subject:you': 0.87; 'good,': 0.91; 'thing,': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Z23IG7W6XTQYQdm9aaZ6LLpD2rYUEtsjETq9vpnBe8I=; b=GYnzPhhMkaxXIJoWx2SjOtywuhAel0OZtkMJ9k7PIPBJx3q4Omuv0JjUpk59il34wf Y0C6Xcx3+oq6tkejSUvfKs9NMQcsfz2E9PZoscnjX0oPvrDWzwhajIaBM2PiEgELCa++ 4hfUoYSjPM2cvfLgT4oKTNehSG2Ywqf6oY4Hy6pyuRxwzOvkwVJiy1o8NLU5BdKK6caJ v9Afx9odeNF2gqsrSNPDZFXfa2yT6eUYqAQmplV8sY4Qh9ggKlW125rs3poUNRr4XzHI CeT5EaHN6zIFbgoId2XhEEN4+XLIqv5SleC5fIWpgRnaXjyOJH6aagLiclf2FBTubJOx S1Rg== MIME-Version: 1.0 X-Received: by 10.58.74.164 with SMTP id u4mr787020vev.81.1401803265554; Tue, 03 Jun 2014 06:47:45 -0700 (PDT) In-Reply-To: References: Date: Tue, 3 Jun 2014 23:47:45 +1000 Subject: Re: Would a Python 2.8 help you port to Python 3? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401803273 news.xs4all.nl 2832 [2001:888:2000:d::a6]:34696 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72518 On Tue, Jun 3, 2014 at 10:40 PM, Mark Lawrence wrote: > An interesting article from Lennart Regebro > http://regebro.wordpress.com/2014/06/03/would-a-python-2-8-help-you-port-to-python-3/ > 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. Without help: try: import configparser except ImportError: import ConfigParser as configparser With six: from six.moves import configparser The theoretical Python 2.8 version isn't shown, but presumably it would be: import configparser 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. ChrisA