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

2014-06-06 Thread Larry Hudson
On 06/06/2014 01:42 AM, Johannes Bauer wrote: Ah, I didn't know rstrip() accepted parameters and since you wrote line.rstrip() this would also cut away whitespaces (which sadly are relevant in odd cases). No problem. If a parameter is used in the strip() family, than _only_ those characters

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

2014-06-06 Thread Grant Edwards
On 2014-06-06, Roy Smith wrote: >> Roy is using MT-NewsWatcher as a client. > > Yes. Except for the fact that it hasn't kept up with unicode, I find > the U/I pretty much perfect. I imagine at some point I'll be force to > look elsewhere, but then again, netnews is pretty much dead. There ar

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

2014-06-06 Thread Steven D'Aprano
On Fri, 06 Jun 2014 10:47:44 +0200, Johannes Bauer wrote: > Hm, I was under the impression that Python already took care of removing > the \r at a line ending. Checking that right now: [snip example] This is called "Universal Newlines". Technically it is a build-time option which applies when yo

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

2014-06-06 Thread Tim Chase
On 2014-06-06 10:47, Johannes Bauer wrote: > > Personally I tend toward rstrip('\r\n') so that I don't have to > > worry about files with alternative line terminators. > > Hm, I was under the impression that Python already took care of > removing the \r at a line ending. Checking that right now: >

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

2014-06-06 Thread Johannes Bauer
On 05.06.2014 22:18, Ian Kelly wrote: > Personally I tend toward rstrip('\r\n') so that I don't have to worry > about files with alternative line terminators. Hm, I was under the impression that Python already took care of removing the \r at a line ending. Checking that right now: (DOS encoded f

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

2014-06-06 Thread Johannes Bauer
On 05.06.2014 20:52, Ryan Hiebert wrote: > 2014-06-05 13:42 GMT-05:00 Johannes Bauer : > >> On 05.06.2014 20:16, Paul Rubin wrote: >>> Johannes Bauer writes: line = line[:-1] Which truncates the trailing "\n" of a textfile line. >>> >>> use line.rstrip() for that. >> >> rstrip has diffe

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

2014-06-05 Thread Ned Deily
In article , Roy Smith wrote: > In article , > Ned Deily wrote: > > Roy is using MT-NewsWatcher as a client. > Yes. Except for the fact that it hasn't kept up with unicode, I find > the U/I pretty much perfect. I imagine at some point I'll be force to > look elsewhere, but then again, netne

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

2014-06-05 Thread Roy Smith
In article , Ned Deily wrote: > In article <8681edf0-7a1f-4110-9f87-a8cd0988c...@googlegroups.com>, > Rustom Mody wrote: > > > On Friday, June 6, 2014 2:30:26 AM UTC+5:30, Roy Smith wrote: > > > Just for fun, I took a screen-shot of what this looks like in my > > > newsreader. URL below. L

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

2014-06-05 Thread Ian Kelly
On Thu, Jun 5, 2014 at 2:34 PM, Albert-Jan Roskam wrote: >> If you want to be really picky about removing exactly one line >> terminator, then this captures all the relatively modern variations: >> re.sub('\r?\n$|\n?\r$', line, '', count=1) > > or perhaps: re.sub("[^ \S]+$", "", line) That will r

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

2014-06-05 Thread Ned Deily
In article <8681edf0-7a1f-4110-9f87-a8cd0988c...@googlegroups.com>, Rustom Mody wrote: > On Friday, June 6, 2014 2:30:26 AM UTC+5:30, Roy Smith wrote: > > Just for fun, I took a screen-shot of what this looks like in my > > newsreader. URL below. Looks like something chomped on unicode pretty

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

2014-06-05 Thread Rustom Mody
On Friday, June 6, 2014 2:30:26 AM UTC+5:30, Roy Smith wrote: > Just for fun, I took a screen-shot of what this looks like in my > newsreader. URL below. Looks like something chomped on unicode pretty > hard :-) > > http://www.panix.com/~roy/unicode.pdf Yii -- ht

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

2014-06-05 Thread Roy Smith
In article , Albert-Jan Roskam wrote: > - Original Message - > From: Ian Kelly > > To: Python > Cc: > Sent: Thursday, June 5, 2014 > 10:18 PM > Subject: Re: Unicode and Python - how often do you index strings? > > > On Thu, Jun 5, 2014 at

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

2014-06-05 Thread Albert-Jan Roskam
- Original Message - > From: Ian Kelly > To: Python > Cc: > Sent: Thursday, June 5, 2014 10:18 PM > Subject: Re: Unicode and Python - how often do you index strings? > > On Thu, Jun 5, 2014 at 1:58 PM, Paul Rubin > wrote: >> Ryan Hiebert writes:

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

2014-06-05 Thread Ian Kelly
On Thu, Jun 5, 2014 at 1:58 PM, Paul Rubin wrote: > Ryan Hiebert writes: >> How so? I was using line=line[:-1] for removing the trailing newline, and >> just replaced it with rstrip('\n'). What are you doing differently? > > rstrip removes all the newlines off the end, whether there are zero or >

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

2014-06-05 Thread Ryan Hiebert
On Thu, Jun 5, 2014 at 2:59 PM, Chris Angelico wrote: > On Fri, Jun 6, 2014 at 4:52 AM, Ryan Hiebert wrote: > > 2014-06-05 13:42 GMT-05:00 Johannes Bauer : > > > >> On 05.06.2014 20:16, Paul Rubin wrote: > >> > Johannes Bauer writes: > >> >> line = line[:-1] > >> >> Which truncates the trailing

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

2014-06-05 Thread Paul Rubin
Ryan Hiebert writes: > How so? I was using line=line[:-1] for removing the trailing newline, and > just replaced it with rstrip('\n'). What are you doing differently? rstrip removes all the newlines off the end, whether there are zero or multiple. In perl the difference is chomp vs chop. line=l

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

2014-06-05 Thread Chris Angelico
On Fri, Jun 6, 2014 at 4:52 AM, Ryan Hiebert wrote: > 2014-06-05 13:42 GMT-05:00 Johannes Bauer : > >> On 05.06.2014 20:16, Paul Rubin wrote: >> > Johannes Bauer writes: >> >> line = line[:-1] >> >> Which truncates the trailing "\n" of a textfile line. >> > >> > use line.rstrip() for that. >> >>

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

2014-06-05 Thread Ryan Hiebert
2014-06-05 13:42 GMT-05:00 Johannes Bauer : > On 05.06.2014 20:16, Paul Rubin wrote: > > Johannes Bauer writes: > >> line = line[:-1] > >> Which truncates the trailing "\n" of a textfile line. > > > > use line.rstrip() for that. > > rstrip has different functionality than what I'm doing. How so

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

2014-06-05 Thread Johannes Bauer
On 05.06.2014 20:16, Paul Rubin wrote: > Johannes Bauer writes: >> line = line[:-1] >> Which truncates the trailing "\n" of a textfile line. > > use line.rstrip() for that. rstrip has different functionality than what I'm doing. Cheers, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vor

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

2014-06-05 Thread Paul Rubin
Johannes Bauer writes: > line = line[:-1] > Which truncates the trailing "\n" of a textfile line. use line.rstrip() for that. -- https://mail.python.org/mailman/listinfo/python-list

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

2014-06-05 Thread alister
On Thu, 05 Jun 2014 18:15:31 +0100, Mark Lawrence wrote: >>> >> The problem is that thing look fine in google groups. What helps is >> getting to see what the mess looks like from Thunderbird or equivalent. >> >> > Wrong. 99.99% of people when asked politely take action so there is no > problem.

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

2014-06-05 Thread Joshua Landau
On 4 June 2014 15:50, Michael Torrie wrote: > On 06/04/2014 12:50 AM, wxjmfa...@gmail.com wrote: >> [Things] > > [Reply to things] Please. Just don't. -- https://mail.python.org/mailman/listinfo/python-list

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

2014-06-05 Thread Mark Lawrence
On 05/06/2014 16:57, Mark H Harris wrote: On 6/5/14 10:39 AM, alister wrote: {snipped all the mess} And you have may time been given a link explaining the problems with posting g=from google groups but deliberately choose to not make your replys readable. The problem is that thing look fine

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

2014-06-05 Thread Johannes Bauer
On 04.06.2014 02:39, Chris Angelico wrote: > I know the collective experience of python-list can't fail to bring up > a few solid examples here :) Just also grepped lots of code and have surprisingly few instances of index-search. Most are with constant indices. One particular example that comes

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

2014-06-05 Thread Mark H Harris
On 6/5/14 10:39 AM, alister wrote: {snipped all the mess} And you have may time been given a link explaining the problems with posting g=from google groups but deliberately choose to not make your replys readable. The problem is that thing look fine in google groups. What helps is getting to

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

2014-06-05 Thread alister
On Thu, 05 Jun 2014 00:06:54 -0700, wxjmfauth wrote: > Le mercredi 4 juin 2014 16:50:59 UTC+2, Michael Torrie a écrit : >> On 06/04/2014 12:50 AM, wxjmfa...@gmail.com wrote: >> >> > Like many, you are not understanding unicode because >> >> > you do not understand the coding of characters. >> >

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

2014-06-05 Thread Marko Rauhamaa
wxjmfa...@gmail.com: > Unicode ? > I have the feeling is similar as explaining, > i (the imaginary number) is not equal to > sqrt(-1). > > jmf > > PS Once I gave you a link pointing > to unicode.org doc, you obviously did not read it. Sir, you are an artist, a poet even! With admiration, Marko

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

2014-06-04 Thread Dave Angel
Chris Angelico Wrote in message: > On Wed, Jun 4, 2014 at 8:10 PM, Peter Otten <__pete...@web.de> wrote: >> The indices used for slicing typically don't come out of nowhere. A simple >> example would be >> >> def strip_prefix(text, prefix): >> if text.startswith(prefix): >> text = text

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

2014-06-04 Thread Michael Torrie
On 06/04/2014 12:50 AM, wxjmfa...@gmail.com wrote: > Like many, you are not understanding unicode because > you do not understand the coding of characters. If that is true, then I'm sure a well-written paragraph or two can set him straight. You continually berate people for not understanding unic

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

2014-06-04 Thread alister
On Wed, 04 Jun 2014 05:52:24 -0700, Rustom Mody wrote: > On Wednesday, June 4, 2014 4:20:01 PM UTC+5:30, alister wrote: >> The language is ENGLISH so the correct spelling is Centre regional >> variations my be common but they are incorrect > > "my"? > > O mee Oo my -- cockney (or Aussie) pedant?

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

2014-06-04 Thread wxjmfauth
Le mercredi 4 juin 2014 02:39:54 UTC+2, Chris Angelico a écrit : > A current discussion regarding Python's Unicode support centres (or > > centers, depending on how close you are to the cent[er]{2} of the > > universe) around one critical question: Is string indexing common? > > > > Python str

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

2014-06-04 Thread Rustom Mody
On Wednesday, June 4, 2014 4:20:01 PM UTC+5:30, alister wrote: > The language is ENGLISH so the correct spelling is Centre regional > variations my be common but they are incorrect "my"? O mee Oo my -- cockney (or Aussie) pedant?? -- https://mail.python.org/mailman/listinfo/python-list

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

2014-06-04 Thread alister
On Wed, 04 Jun 2014 18:48:29 +1200, Gregory Ewing wrote: > Chris Angelico wrote: >> On Wed, Jun 4, 2014 at 11:18 AM, Roy Smith wrote: >> >>>Um, you mean cent(er|re), don't you? The >>>pattern you wrote also matches centee and centrr. >> >> Maybe there's someone who spells it that way! > > Com

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

2014-06-04 Thread alister
On Tue, 03 Jun 2014 21:18:12 -0400, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> A current discussion regarding Python's Unicode support centres (or >> centers, depending on how close you are to the cent[er]{2} of the >> universe) > > Um, you mean cent(er|re), don't you? The >

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

2014-06-04 Thread Chris Angelico
On Wed, Jun 4, 2014 at 8:10 PM, Peter Otten <__pete...@web.de> wrote: > The indices used for slicing typically don't come out of nowhere. A simple > example would be > > def strip_prefix(text, prefix): > if text.startswith(prefix): > text = text[len(prefix):] > return text > > If bo

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

2014-06-04 Thread Peter Otten
Mark Lawrence wrote: > On 04/06/2014 01:39, Chris Angelico wrote: >> A current discussion regarding Python's Unicode support centres (or >> centers, depending on how close you are to the cent[er]{2} of the >> universe) around one critical question: Is string indexing common? >> >> Python strings c

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

2014-06-04 Thread Chris Angelico
On Wed, Jun 4, 2014 at 6:22 PM, Mark Lawrence 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 fo

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

2014-06-04 Thread Mark Lawrence
On 04/06/2014 01:39, Chris Angelico wrote: A current discussion regarding Python's Unicode support centres (or centers, depending on how close you are to the cent[er]{2} of the universe) around one critical question: Is string indexing common? Python strings can be indexed with integers to produ

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

2014-06-03 Thread Gregory Ewing
Chris Angelico wrote: On Wed, Jun 4, 2014 at 11:18 AM, Roy Smith wrote: Um, you mean cent(er|re), don't you? The pattern you wrote also matches centee and centrr. Maybe there's someone who spells it that way! Come visit Pirate Island, the centrr of the universe! -- Pegleg Greg -- https:/

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

2014-06-03 Thread Tim Chase
On 2014-06-04 12:16, Chris Angelico wrote: > On Wed, Jun 4, 2014 at 11:11 AM, Tim Chase > 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[

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

2014-06-03 Thread Chris Angelico
On Wed, Jun 4, 2014 at 11:11 AM, Tim Chase 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

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

2014-06-03 Thread Chris Angelico
On Wed, Jun 4, 2014 at 11:18 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> A current discussion regarding Python's Unicode support centres (or >> centers, depending on how close you are to the cent[er]{2} of the >> universe) > > Um, you mean cent(er|re), don't you? The > patt

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

2014-06-03 Thread Ethan Furman
On 06/03/2014 05:39 PM, Chris Angelico wrote: A current discussion regarding Python's Unicode support centres (or centers, depending on how close you are to the cent[er]{2} of the universe) around one critical question: Is string indexing common? I use it quite a bit, but the strings are usual

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

2014-06-03 Thread Roy Smith
In article , Chris Angelico wrote: > A current discussion regarding Python's Unicode support centres (or > centers, depending on how close you are to the cent[er]{2} of the > universe) Um, you mean cent(er|re), don't you? The pattern you wrote also matches centee and centrr. > around one cri

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

2014-06-03 Thread Tim Chase
On 2014-06-04 10:39, Chris Angelico wrote: > A current discussion regarding Python's Unicode support centres (or > centers, depending on how close you are to the cent[er]{2} of the > universe) around one critical question: Is string indexing common? > > Python strings can be indexed with integers

Unicode and Python - how often do you index strings?

2014-06-03 Thread Chris Angelico
A current discussion regarding Python's Unicode support centres (or centers, depending on how close you are to the cent[er]{2} of the universe) around one critical question: Is string indexing common? Python strings can be indexed with integers to produce characters (strings of length 1). They can