Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!roy From: Roy Smith Newsgroups: comp.lang.python Subject: Re: Performance of int/long in Python 3 Date: Sat, 06 Apr 2013 22:18:08 -0400 Organization: PANIX Public Access Internet and UNIX, NYC Lines: 29 Message-ID: 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> NNTP-Posting-Host: localhost X-Trace: reader1.panix.com 1365301088 25222 127.0.0.1 (7 Apr 2013 02:18:08 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Sun, 7 Apr 2013 02:18:08 +0000 (UTC) User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: csiph.com comp.lang.python:42968 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.