Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.05; 'subject:Python': 0.06; 'explicit': 0.07; 'python3': 0.07; 'sys': 0.07; 'string': 0.09; 'pointless': 0.09; 'toss': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; '2.7': 0.14; '__future__': 0.16; 'fine.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'object),': 0.16; 'subclass': 0.16; 'sys.path': 0.16; 'wrote:': 0.18; 'library': 0.18; 'first.': 0.19; 'feb': 0.22; 'import': 0.22; 'rules': 0.22; 'cc:addr:python.org': 0.22; '2.x': 0.24; 'stick': 0.24; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; '13,': 0.31; '3.x': 0.31; '>>>>': 0.31; 'division': 0.31; 'intellectual': 0.31; 'compatible': 0.32; 'linux': 0.33; 'fri,': 0.33; 'older': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'hat': 0.38; 'nov': 0.38; 'that,': 0.38; 'worry': 0.60; 'simple': 0.61; 'pick': 0.64; 'more': 0.64; 'nobody': 0.68; 'bulk': 0.74; '2014,': 0.84; '2015': 0.84; 'to:none': 0.92; 'lot,': 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=JTK+cL0yaoWHgYhKn0vnGrv6QZ9soSbYpi2MaWP0LoQ=; b=zo/xMZtAtSCeJfsJ2rhMb76QoYeQhCIR8cqH9eDHkW+OfTLomJNFsjyjNfWmu3Wras XmfD4lHoy/FZkhAbUV8/gJSX3okN3GFNIUqi/VR1mgKshrxhBpS24VNpw4I6ENoLebyL fH86azUVE4byisvtHsZO7TOI6Ea8XmwmYcxv07w0qyqF3HDFglNIVbfXSgo36N5X2qux lqHhDutf6BbxdEYuxGKIX5hn+8IAemgRVgrpal7BQBi43VGtuAhM2zDqXoicToOd78mH WZPM/CyILHhWcav51GD7tvYeD2xp7CQypCpCXCACyS9WAgulyX/oysqRVp7GdKLAlQiY Gh6A== MIME-Version: 1.0 X-Received: by 10.42.13.193 with SMTP id e1mr8337758ica.59.1423760906995; Thu, 12 Feb 2015 09:08:26 -0800 (PST) In-Reply-To: <87oaozcbld.fsf@elektro.pacujo.net> References: <54dc6870$0$12981$c3e8da3$5496439d@news.astraweb.com> <6322f4fa-c8af-4051-b6c6-ff953bd928ca@googlegroups.com> <87zj8jcqxr.fsf@elektro.pacujo.net> <87twyrchxi.fsf@elektro.pacujo.net> <87oaozcbld.fsf@elektro.pacujo.net> Date: Fri, 13 Feb 2015 04:08:26 +1100 Subject: Re: Python discussed in Nature 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1423760909 news.xs4all.nl 2975 [2001:888:2000:d::a6]:56404 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85593 On Fri, Feb 13, 2015 at 3:56 AM, Marko Rauhamaa wrote: > $ python3 > Python 3.4.1 (default, Nov 3 2014, 14:38:10) > [GCC 4.9.1 20140930 (Red Hat 4.9.1-11)] on linux > Type "help", "copyright", "credits" or "license" for more information. >>>> import sys >>>> sys.path = [ '/usr/lib64/python2.7' ] + sys.path Interesting for intellectual curiosity, but not particularly significant. All you prove is that the 2.7 stdlib is designed for compatibility with older 2.x Pythons (or, looking the other way, nobody wants pointless code churn in working code). The best way to write 2/3 compatible code is to write 3.x code first. Then just adhere to a few simple rules (eg always subclass object), and the bulk of your code will work just fine. You might need to toss in some explicit __future__ directives (print_function if you don't stick to "exactly one string argument to print", and division if you don't want to have to worry about the differences), and if you do this a lot, you might want to pick up the 'six' library or equivalent, but other than that, there's really not much to deal with. ChrisA