Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!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.030 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'else:': 0.03; 'elif': 0.05; 'subject:Python': 0.06; 'feature.': 0.09; 'width': 0.09; 'backward': 0.16; 'roy': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'otherwise,': 0.22; 'adds': 0.24; 'char': 0.24; "shouldn't": 0.24; 'simpler': 0.24; 'string,': 0.24; 'decide': 0.24; 'earlier': 0.24; 'versions': 0.24; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'feature': 0.29; 'character': 0.29; "doesn't": 0.30; '???': 0.30; 'message-id:@mail.gmail.com': 0.30; 'largest': 0.30; "d'aprano": 0.31; 'noted': 0.31; 'steven': 0.31; 'another': 0.32; 'received:209.85': 0.35; 'definition': 0.35; 'one,': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'version': 0.36; 'really': 0.36; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'ian': 0.60; 'new': 0.61; "you're": 0.61; 'you.': 0.62; 'more': 0.64; 'smith': 0.68; 'article': 0.77; '3.4': 0.84; 'subject:long': 0.84; 'inefficient': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=htTVyQEarncq3Mq4FOpkRHHcFzYnrAx0nVWUzIrALx8=; b=Mtfq5Je3+97m38LvgKEqUU60jBnFUQa4RGg76G11mFT65d+VqdmxIlqRjYKnXFOqgS rfVPjBuiePWuRviFqCn+9ChB2JvEAQiObWSzXgmbW2lgY2NltZFPHTHARwQtsYCsczGm Sc6sRS6FclOop62Xv4zyoYr5HoTWyJjcIRv6MieqNJ47VJnrJ/MAnOAr8XN5N1FZtT7k FlqMTwIV0iyRUr8X8p40/qeQs+GQNzudHUKteaTCyy7GHB8GF4pFGqGsQmnTacwzxdT6 rWMSsnB2yeEfgAlhjTVsWIYTpzQRd2L3QdFxp1+FiUCNJUpJA9VTmsGXgOnO1ogBZDpw SD9Q== X-Received: by 10.52.177.163 with SMTP id cr3mr10576067vdc.94.1365312189616; Sat, 06 Apr 2013 22:23:09 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <3qadncD4-6fcPsbMnZ2dnUVZ_rqdnZ2d@westnet.com.au> <515bbedb$0$29891$c3e8da3$5496439d@news.astraweb.com> <515be00e$0$29891$c3e8da3$5496439d@news.astraweb.com> <515c45ad$0$29966$c3e8da3$5496439d@news.astraweb.com> <5160cbeb$0$29995$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Sat, 6 Apr 2013 23:22:29 -0600 Subject: Re: Performance of int/long in Python 3 To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365312197 news.xs4all.nl 6888 [2001:888:2000:d::a6]:42624 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42978 On Sat, Apr 6, 2013 at 8:18 PM, Roy Smith wrote: > In article , > Ian Kelly wrote: > >> On Sat, Apr 6, 2013 at 7:29 PM, Steven D'Aprano >> wrote: >> > For some definition of "easily". >> > >> > if implementation == "CPython": >> > if version < "3.3": >> > if sys.maxunicode exists: >> > use it to decide whether this is a wide or narrow build >> > if a wide build: return 4 >> > else: return 2 >> > else: >> > ??? >> > elif version == "3.3": >> > scan the string, in some efficient or inefficient way >> > return 1, 2, 4 depending on the largest character you find >> > else: >> > ??? >> > else: >> > ??? >> >> None of which goes away if a char width function is added to 3.4 and >> you still want to support earlier versions as this does. It just adds >> another "if". > > The same is true of any new feature. That doesn't mean we shouldn't add > new features. If you're interested in backward compatibility, then as noted the feature doesn't really make things any simpler for you. Otherwise, the only implementation that matters from the above is the 3.3 one, which isn't much more complex.