Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #72620 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2014-06-04 19:30 +1000 |
| Last post | 2014-06-04 19:30 +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.
Re: Unicode and Python - how often do you index strings? Chris Angelico <rosuav@gmail.com> - 2014-06-04 19:30 +1000
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-06-04 19:30 +1000 |
| Subject | Re: Unicode and Python - how often do you index strings? |
| Message-ID | <mailman.10693.1401874213.18130.python-list@python.org> |
On Wed, Jun 4, 2014 at 6:22 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote: > Single characters quite often, iteration rarely if ever, slicing all the > time, but does that last one count? Yes, slicing counts. What matters here is the potential impact of internally representing strings as UTF-8 streams; when you ask for the Nth character, it would have to scan from either the beginning or end (more likely beginning) of the string and count, instead of doing what CPython 3.3+ does and simply look up the header to find out the kind, bit-shift the index by one less than that, and use that as a memory location. ChrisA
Back to top | Article view | comp.lang.python
csiph-web