Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'string.': 0.05; 'indexing': 0.07; 'string': 0.09; '32-bit': 0.09; 'character,': 0.09; 'counting': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'span': 0.09; 'subject:language': 0.09; 'supported,': 0.09; 'tismer': 0.09; 'python': 0.11; 'expensive,': 0.16; 'iteration': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'surrogate': 0.16; 'underlying': 0.16; 'language': 0.16; 'wrote:': 0.18; 'trying': 0.19; "hasn't": 0.19; '>>>': 0.22; 'programming': 0.22; 'manual': 0.22; 'header:User-Agent:1': 0.23; 'string,': 0.24; 'unicode': 0.24; 'mon,': 0.24; 'equivalent': 0.26; 'second': 0.26; 'certain': 0.27; 'header:X-Complaints-To:1': 0.27; 'van': 0.27; 'header:In-Reply-To:1': 0.27; 'appear': 0.29; 'chris': 0.29; 'am,': 0.29; 'character': 0.29; 'characters': 0.30; "i'm": 0.30; '>>>>': 0.31; 'operations.': 0.31; 'writes:': 0.31; 'this.': 0.32; 'figure': 0.32; 'beginning': 0.33; 'subject: (': 0.35; 'agree': 0.35; 'operations': 0.35; 'but': 0.35; 'there': 0.35; "didn't": 0.36; 'thanks': 0.36; 'searching': 0.37; 'so,': 0.37; 'christian': 0.38; 'nov': 0.38; 'requiring': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'ian': 0.60; 'world.': 0.61; 'world': 0.66; 'population': 0.68; 'find.': 0.84; 'received:2': 0.84; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Oh look, another language (ceylon) Date: Mon, 18 Nov 2013 15:06:35 +0000 References: <1f0ffad0-f9b1-4154-b048-510d8e38846e@googlegroups.com> <41f332dd-1c31-4699-9176-7e8589f9c8ae@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-2-98-194-3.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 In-Reply-To: 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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384787216 news.xs4all.nl 15916 [2001:888:2000:d::a6]:47150 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:59878 On 18/11/2013 14:31, Piet van Oostrum wrote: > Chris Angelico writes: > >> On Mon, Nov 18, 2013 at 11:29 PM, Ian Kelly wrote: >>> >>> On Nov 18, 2013 3:06 AM, "Chris Angelico" wrote: >>>> >>>> I'm trying to figure this out. Reading the docs hasn't answered this. >>>> If each character in a string is a 32-bit Unicode character, and (as >>>> can be seen in the examples) string indexing and slicing are >>>> supported, then does string indexing mean counting from the beginning >>>> to see if there were any surrogate pairs? >>> >>> The string reference says: >>> >>> """Since a String has an underlying UTF-16 encoding, certain operations are >>> expensive, requiring iteration of the characters of the string. In >>> particular, size requires iteration of the whole string, and get(), span(), >>> and segment() require iteration from the beginning of the string to the >>> given index.""" >>> >>> The get and span operations appear to be equivalent to indexing and slicing. >> >> Right, that's what I was looking for and didn't find. (I was searching >> the one-page reference manual rather than reading in detail.) So, yes, >> they're O(n) operations. Thanks for hunting that down. >> >> ChrisA > > It would be so much better to use the Flexible String Representation. > I agree but approximately 0.0000000142857% of the world population disagrees. -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence