Performance of int/long in Python 3

Chris Angelico rosuav at gmail.com
Wed Apr 3 17:57:19 EDT 2013


On Thu, Apr 4, 2013 at 2:07 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Thu, 04 Apr 2013 01:17:28 +1100, Chris Angelico wrote:
>
>> Probably, but it still has to scan the body of the string. It'd not be
>> too bad if it's all astral, but if it's all BMP, it has to scan the
>> whole string. In the max() case, it has to scan the whole string anyway,
>> as there's no other way to determine the maximum. I'm thinking here of
>> this function:
>>
>> http://pike.lysator.liu.se/generated/manual/modref/ex/7.2_3A_3A/String/
> width.html
>>
>> It's implemented as a simple lookup into the header. (Pike strings, like
>> PEP 393 strings, are stored in the most compact way possible - 1, 2, or
>> 4 bytes per character - with a conceptually similar header structure.)
>> Is this something that would be worth having available? Should I post an
>> issue about it?
>
> I'm not really sure why I would want to know, apart from pure
> intellectual curiosity, but sure, post a feature request. Be sure to
> mention that Pike supports this feature.

http://bugs.python.org/issue17629 opened.

ChrisA



More information about the Python-list mailing list