Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #72574 > unrolled thread

Re: Unicode and Python - how often do you index strings?

Started byChris Angelico <rosuav@gmail.com>
First post2014-06-04 12:16 +1000
Last post2014-06-04 12:16 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Unicode and Python - how often do you index strings? Chris Angelico <rosuav@gmail.com> - 2014-06-04 12:16 +1000

#72574 — Re: Unicode and Python - how often do you index strings?

FromChris Angelico <rosuav@gmail.com>
Date2014-06-04 12:16 +1000
SubjectRe: Unicode and Python - how often do you index strings?
Message-ID<mailman.10665.1401848197.18130.python-list@python.org>
On Wed, Jun 4, 2014 at 11:11 AM, Tim Chase
<python.list@tim.thechases.com> wrote:
> I then take row 2 and use it to make a mapping of header-name to a
> slice-object for slicing the subsequent strings:
>
>       slice(i.start(), i.end())
>
>     print("EmpID = %s" % row[header_map["EMPID"]].strip())
>     print("Name = %s" % row[header_map["NAME"]].strip())
>
> which I presume uses string indexing under the hood.

Yes, it's definitely going to be indexing. If strings were represented
internally in UTF-8, each of those calls would need to scan from the
beginning of the string, counting and discarding characters until it
finds the place to start, then counting and retaining characters until
it finds the place to stop. Definite example of what I'm looking for,
thanks!

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web