Performance of int/long in Python 3

Chris Angelico rosuav at gmail.com
Wed Apr 3 02:52:21 EDT 2013


On Wed, Apr 3, 2013 at 5:29 PM, Neil Hodgson <nhodgson at iinet.net.au> wrote:
> Chris Angelico:
>
>
>> I'd be curious to know the sorts of characters used. Given that it's
>> probably a narrow-vs-wide Python difference we're talking here, the
>> actual distribution of codepoints may well make a difference.
>
>
>    I was going to upload it but then I thought of potential client
> -confidentiality problems and the need to audit a list that long.

Hmm. I was about to say "Can you just do a quick collections.Counter()
of the string widths in 3.3, as an easy way of seeing which ones use
BMP or higher characters", but I can't find a simple way to query a
string's width. Can't see it as a method of the string object, nor in
the string or sys modules. It ought to be easy enough at the C level -
just look up the two bits representing 'kind' - but I've not found it
exposed to Python. Is there anything?

ChrisA



More information about the Python-list mailing list