Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'python.': 0.02; 'subject:Python': 0.06; 'sys': 0.07; 'string': 0.09; 'bits': 0.09; '3.3,': 0.16; 'hmm.': 0.16; 'modules.': 0.16; 'ought': 0.16; 'width.': 0.16; 'wrote:': 0.18; 'wed,': 0.18; "i've": 0.25; 'query': 0.26; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'object,': 0.36; 'representing': 0.36; 'method': 0.36; 'two': 0.37; 'level': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'enough': 0.39; 'easy': 0.60; 'simple': 0.61; '"can': 0.84; 'subject:long': 0.84; '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=z5hMVwgrwUWNLQ29GNF7zrzr5PffSe+hOl0au2xTZZc=; b=gzuf+IZ0F5kDoW+dAwSPzlSlofqGb2mH32p2sLDFr8x3a6/FRY+WhoyFY7S+93S4Lb kBarGqWUj1UvnOQGbqPSFV4yd8LIy2PxY6PjZ9Sv2fVyvgu25qXQY3/WfWH6FFCMvdDE aC2qeIeSy4LMlzHUGPbmmTnQTdLuDr8cCtUk5KnFW+tFjcOGKZb9xR9WYp/v8duB4FCg ZjD6n4NomYwhCFL+i0cA2rragPH1fd6X5vNG32cjSXZRijU9xWWioAmvckfqh9EdDB3T cNxH+giSltjiw1S3guAxGZNDkwR5Qr8iaaIGpFP1PkM2pDpRlPxjnbaNbbQD9EmCz37k 4e0w== X-Received: by 10.68.65.226 with SMTP id a2mr820133pbt.92.1364972833814; Wed, 03 Apr 2013 00:07:13 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <515941d8$0$29967$c3e8da3$5496439d@news.astraweb.com> <5159beb6$0$29967$c3e8da3$5496439d@news.astraweb.com> <4103dc28-a0dc-4740-bb38-b6bcb58bedfb@h1g2000vbx.googlegroups.com> <87dff083-14d8-4163-89f3-d78a9be6c802@c15g2000vbl.googlegroups.com> <3qadncD4-6fcPsbMnZ2dnUVZ_rqdnZ2d@westnet.com.au> <515bbedb$0$29891$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Wed, 3 Apr 2013 01:06:33 -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: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364972837 news.xs4all.nl 6870 [2001:888:2000:d::a6]:34853 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42637 On Wed, Apr 3, 2013 at 12:52 AM, Chris Angelico wrote: > 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? 4 if max(map(ord, s)) > 0xffff else 2 if max(map(ord, s)) > 0xff else 1