Performance of int/long in Python 3

Roy Smith roy at panix.com
Sat Apr 6 22:18:08 EDT 2013


In article <mailman.222.1365299932.3114.python-list at python.org>,
 Ian Kelly <ian.g.kelly at gmail.com> wrote:

> On Sat, Apr 6, 2013 at 7:29 PM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> 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.



More information about the Python-list mailing list