Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'languages.': 0.04; '21,': 0.07; 'c++,': 0.07; 'python3': 0.07; 'suppose': 0.07; '#define': 0.09; 'instance.': 0.09; 'toss': 0.09; 'whichever': 0.09; 'runs': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; '"from': 0.16; '4:59': 0.16; '__future__': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'happily': 0.16; 'naming': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'possible,': 0.19; 'written': 0.21; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'certainly': 0.24; 'expanded': 0.24; 'unicode': 0.24; 'versions': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; "i've": 0.25; 'header:In- Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'easier': 0.31; 'operations.': 0.31; 'perl': 0.31; 'restricted': 0.31; 'run': 0.32; 'fri,': 0.33; 'maybe': 0.34; 'could': 0.34; "can't": 0.35; 'common': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'vice': 0.36; 'problems': 0.38; 'handle': 0.38; 'pm,': 0.38; 'expect': 0.39; 'sure': 0.39; 'either': 0.39; 'how': 0.40; 'skip:u 10': 0.60; 'easy': 0.60; 'myself': 0.63; 'worth': 0.66; 'biggest': 0.67; 'mar': 0.68; 'judge': 0.68; 'apart': 0.72; 'audience': 0.74; 'lowest': 0.74; '*really*': 0.84; 'batchelder': 0.84; 'comment.': 0.84; 'cost,': 0.84; 'differences,': 0.84; 'pike': 0.84; 'regarded': 0.84; 'ships': 0.84; 'worthwhile.': 0.84; 'care,': 0.91; 'to:none': 0.92; 'choice.': 0.93 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=zoIoAL5bx5bVwlu3AJqzRQ5PNRADAKSe1TmJNgjWJZg=; b=cyRBLiUVelMTPSFYcGGMYFVpi6Hp0ndOfYbDz6uwdSsFIeo20F8nqhD0w6No/hkhXg 3mSpWUMVzEGf23dD2K/UgnjJ0C/QXHyN7IsOcRnHtUfD3rRi/XggYueBEnsoS5HTKv7C QBu3pRkESBU6MW3qEQq9i3hbWLUFU6Vu0OKawCSWg3sU0R3G164czX0sPqX/PBGmxTwX ja8a9os9FuzifOmqiJ9nfCphJlN16W0Taje7l/S0oFitF8bQaIHMKS3SvNpOHc5jSAft eXtXawVtR6P4mwNFi313JXVzPaPuyzwc2kUtXJlu6oTIHuGyda0qxTnKk0jo8LAp/8D/ CRdA== MIME-Version: 1.0 X-Received: by 10.68.235.6 with SMTP id ui6mr48532195pbc.45.1395357505262; Thu, 20 Mar 2014 16:18:25 -0700 (PDT) In-Reply-To: <8738icmrw4.fsf@elektro.pacujo.net> References: <87ob10nbeh.fsf@elektro.pacujo.net> <532B4750.2090006@yahoo.com> <87eh1wpr96.fsf@elektro.pacujo.net> <8738icppoe.fsf@elektro.pacujo.net> <87pplgoac6.fsf@elektro.pacujo.net> <8738icmrw4.fsf@elektro.pacujo.net> Date: Fri, 21 Mar 2014 10:18:25 +1100 Subject: Re: running python 2 vs 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: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395357989 news.xs4all.nl 2851 [2001:888:2000:d::a6]:35270 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68641 On Fri, Mar 21, 2014 at 9:23 AM, Marko Rauhamaa wrote: > Ned Batchelder : >> On 3/20/14 4:59 PM, Marko Rauhamaa wrote: >>> Well, with proper care, I suppose the same code base could support perl >>> as well. ;) >> >> I'm not sure how to take this comment. I feel like you are mocking my >> choice. I wanted to make coverage.py available to as broad an audience >> as possible, something that I think is worthwhile. Yes, there was an >> engineering cost, but the tradeoff was worth it. > > I can't judge if your particular choice was the right one. My only point > is that python2 and python3 are so far apart as to be regarded as > independent languages. They're definitely not independent languages. The biggest change is str/unicode->bytes/str, and you can get part of that in Python 2.6/2.7 with "from __future__ import unicode_literals". You may still run into problems with some functions that expect str and won't take unicode (or vice versa), but it's easy to make code that runs across both versions that way. Then toss in "from __future__ import print_function" and happily use the expanded features of print, or go for the lowest common denominator: print("some single string") which works happily in all versions of Python. I've written code that runs on 2.6+/3.2+. (Or maybe it's 3.1+; whichever version Debian Squeeze ships with.) It's pretty easy. It's certainly a lot easier than writing code that runs as either Pike or C++, for instance. THOSE are independent languages. (And yes, I've written that sort of code. Had a #define block up the top to handle some naming differences, and then restricted myself to a *really* narrow set of common operations. Was a neat way to prove correctness, though.) ChrisA