Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'suppose': 0.07; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; '2.7': 0.14; 'language.': 0.14; 'porting': 0.16; 'range,': 0.16; 'range.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'xrange': 0.16; 'language': 0.16; 'wrote:': 0.18; 'library': 0.18; 'module': 0.19; 'import': 0.22; 'header:User-Agent:1': 0.23; '(for': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply- To:1': 0.27; 'michael': 0.29; 'points': 0.29; 'workaround': 0.31; 'another': 0.32; 'url:python': 0.33; 'third': 0.33; 'but': 0.35; 'doubt': 0.36; 'library.': 0.36; 'transition': 0.36; 'useful': 0.36; 'url:org': 0.36; 'example,': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'then,': 0.60; 'url:3': 0.61; 'kind': 0.63; 'our': 0.64; 'forward': 0.65; 'charset:windows-1252': 0.65; 'here': 0.66; 'six': 0.68; 'wish': 0.70; 'pain': 0.84; 'inefficient': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: l = range(int(1E9)) Date: Sun, 03 May 2015 03:16:04 +0100 References: <87k2wtvbx1.fsf@Equus.decebal.nl> <_M61x.477467$Ek.357048@fx07.am4> <554582E3.4030700@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-78-147-21-168.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: <554582E3.4030700@gmail.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1430619379 news.xs4all.nl 2881 [2001:888:2000:d::a6]:41890 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:89821 On 03/05/2015 03:07, Michael Torrie wrote: > On 05/02/2015 04:33 PM, BartC wrote: >> OK, so it's just an irritation then, as a workaround has been available >> for a long time. (For example, if you use xrange, it won't work on 3.x. >> If you use range, then it might be inefficient on 2.x.) > > In both Python 2.7 and 3.3+, you can use the 3rd-party six module to > help with forward compatibility: > > from six.moves import xrange > > In Python 2.7, it's just the normal xrange (importing is a no op > basically), but in Python 3 it points to range. > > Kind of wish parts of six were in the Python standard library. > Links to other useful third party modules are given here https://docs.python.org/3/howto/pyporting.html I doubt that six will ever make the standard library as 2.7 only has another five years in official support. By that time I suppose we'll to going through the porting pain all over again with the transition from Python 3 to Python 4. Alright, alright, only joking :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence