Re: scandir slower than listdir

2017-07-19 Thread Terry Reedy
On 7/20/2017 1:33 AM, Torsten Bronger wrote: Hallöchen! With a 24,000 files directory on an SSD running Ubuntu, #!/usr/bin/python3 import os, time start = time.time() list(os.listdir("/home/bronger/.saves")) listdir returns a list of na print("listdir:", time.tim

Re: SIGSEGV and SIGILL inside PyCFunction_Call

2017-07-19 Thread dieter
Anders Wegge Keller writes: > ... > I have an ongoing issue with my usenet setup. I'm that one dude who don't > want to learn perl. That means that I have to build inn from source, so I > can enable the python interpreter. That's not so bad, and the errors that > show up have been something that

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Steven D'Aprano
On Thu, 20 Jul 2017 12:40:08 +1000, Chris Angelico wrote: > On Thu, Jul 20, 2017 at 12:12 PM, Steve D'Aprano > wrote: >> On Thu, 20 Jul 2017 08:12 am, Gregory Ewing wrote: >> >>> Chris Angelico wrote: >> [snip overly complex and complicated string implementation] >> >> > An accurate description,

scandir slower than listdir

2017-07-19 Thread Torsten Bronger
Hallöchen! With a 24,000 files directory on an SSD running Ubuntu, #!/usr/bin/python3 import os, time start = time.time() list(os.listdir("/home/bronger/.saves")) print("listdir:", time.time() - start) start = time.time() list(os.scandir("/home/bronger/.saves"))

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Chris Angelico
On Thu, Jul 20, 2017 at 12:12 PM, Steve D'Aprano wrote: > On Thu, 20 Jul 2017 08:12 am, Gregory Ewing wrote: > >> Chris Angelico wrote: > [snip overly complex and complicated string implementation] > An accurate description, but in my own defense, I had misunderstood Marko's idea. Actually, the i

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Steve D'Aprano
On Thu, 20 Jul 2017 08:12 am, Gregory Ewing wrote: > Chris Angelico wrote: [snip overly complex and complicated string implementation] > +1. We should totally do this just to troll the RUE! You're an evil, wicked man, and I love it. -- Steve “Cheer up,” they said, “things could be worse.” So

Re: Users of namedtuple: do you use the _source attribute?

2017-07-19 Thread Rick Johnson
On Tuesday, July 18, 2017 at 12:59:36 AM UTC-5, Terry Reedy wrote: > Yes, No. The developers of the class agree that a trailing > underscore convention would have been better. 'source_' > etc. Which, while encroaching on the "this-is-a-reserved-symbol_" convention, would relieve the current "_st

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Steve D'Aprano
On Thu, 20 Jul 2017 01:30 am, Random832 wrote: > On Tue, Jul 18, 2017, at 22:49, Steve D'Aprano wrote: >> > What about Emoji? >> > U+1F469 WOMAN is two columns wide on its own. >> > U+1F4BB PERSONAL COMPUTER is two columns wide on its own. >> > U+200D ZERO WIDTH JOINER is zero columns wide on its

Re: Combining every pair of list items and creating a new list.

2017-07-19 Thread Rick Johnson
On Tuesday, July 18, 2017 at 5:19:56 AM UTC-5, Rahul K P wrote: > You can use a simple logic and list comprehension. > > so it will be like this > > lst = [1, 2, 3, 4, 5, 6, 7, 8] > print [lst[i:i+2] for i in range(0,len(lst),2)] No no no. Anybody can write code like that! To wow a professor and

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Steve D'Aprano
On Thu, 20 Jul 2017 04:34 am, Mikhail V wrote: > It is also pretty obvious that these Caps makes it harder to read in general. > (more obvious that excessive diacritics, like in French) No it isn't. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, th

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Ben Finney
Random832 writes: > On Tue, Jul 18, 2017, at 19:21, Gregory Ewing wrote: > > Random832 wrote: > > > What about Emoji? > > > U+1F469 WOMAN is two columns wide on its own. > > > U+1F4BB PERSONAL COMPUTER is two columns wide on its own. > > Emoji comes from Japanese 絵文字 - 絵(E) picture, 文字(moji) > ch

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Rick Johnson
On Wednesday, July 19, 2017 at 5:29:23 AM UTC-5, Rhodri James wrote: > when Acorn were developing their version of extended ASCII > in the late 80s, they asked three different University > lecturers in Welsh what extra characters they needed, and > got three different answers. And who would have g

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Rick Johnson
On Wednesday, July 19, 2017 at 1:57:47 AM UTC-5, Steven D'Aprano wrote: > On Wed, 19 Jul 2017 17:51:49 +1200, Gregory Ewing wrote: > > > Chris Angelico wrote: > >> Once you NFC or NFD normalize both strings, identical strings will > >> generally have identical codepoints... You should then be able

Re: rpy2

2017-07-19 Thread Larry Martell
On Wed, Jul 19, 2017 at 6:28 PM, Dennis Lee Bieber wrote: > On Wed, 19 Jul 2017 11:15:03 -0400, Larry Martell > declaimed the following: > >> >>/usr/bin/ld: cannot find -lr_utils >> >>But I could not find how to get libr_utils. >> > > Have you already built/installed R (maybe development

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Rick Johnson
On Tuesday, July 18, 2017 at 10:37:18 PM UTC-5, Steve D'Aprano wrote: > On Wed, 19 Jul 2017 10:34 am, Mikhail V wrote: > > > Ok, in this narrow context I can also agree. > > But in slightly wider context that phrase may sound almost like: > > "neither geometrical shape is better than the other as

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Rick Johnson
On Tuesday, July 18, 2017 at 7:35:13 PM UTC-5, Mikhail V wrote: > ChrisA wrote: > >On Wed, Jul 19, 2017 at 6:05 AM, Mikhail V wrote: > >> On 2017-07-18, Steve D'Aprano wrote: > > > > _Neither system is right or wrong, or better than the > > > > other._ > > > > > > If that is said just "not to hu

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Rick Johnson
On Tuesday, July 18, 2017 at 10:24:54 PM UTC-5, Steve D'Aprano wrote: > On Wed, 19 Jul 2017 10:08 am, Ben Finney wrote: > > > Gregory Ewing writes: > > > > > The term "emoji" is becoming rather strained these days. > > > The idea of "woman" and "personal computer" being > > > emotions is an inte

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Gregory Ewing
Chris Angelico wrote: * Strings with all codepoints < 256 are represented as they currently are (one byte per char). There are no combining characters in the first 256 codepoints anyway. * Strings with all codepoints < 65536 and no combining characters, ditto (two bytes per char). * Strings with

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Gregory Ewing
Grant Edwards wrote: Maybe it was a mistaken spelling of 'fortuned'? Most likely. Interestingly, several sites claimed to be able to tell me things about it. One of them tried to find poetry related to it (didn't find any, though). Another one offered to show me how to pronounce it, and it kin

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Rick Johnson
On Tuesday, July 18, 2017 at 10:07:41 PM UTC-5, Steve D'Aprano wrote: > On Wed, 19 Jul 2017 12:10 am, Rustom Mody wrote: [...] > > Einstein: If you can't explain something to a six-year- > > old, you really don't understand it yourself. > > > > [...] > > Think about it: it simply is nonsense. If

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Terry Reedy
On 7/19/2017 4:28 AM, Steven D'Aprano wrote: On Tue, 18 Jul 2017 10:11:39 -0400, Random832 wrote: On Fri, Jul 14, 2017, at 04:15, Marko Rauhamaa wrote: Consider, for example, a Python source code editor where you want to limit the length of the line based on the number of characters more typ

Re: pyserial and end-of-line specification

2017-07-19 Thread Rob Gaddi
On 07/18/2017 12:53 PM, FS wrote: Thank you for your response Andre. I had tried some code like that in the document but it did not seem to work. However ever leaving my terminal for a time the code eventually wrote out the records so apparently there is some very deep buffering going on here.

Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Mikhail V
Steven D'Aprano wrote: >On Wed, 19 Jul 2017 10:34 am, Mikhail V wrote: >> Ok, in this narrow context I can also agree. >> But in slightly wider context that phrase may sound almost like: >> "neither geometrical shape is better than the other as a basis >> for a wheel. If you have polygonal wheels,

Re: Best way to assert unit test cases with many conditions

2017-07-19 Thread Rob Gaddi
On 07/19/2017 03:26 AM, Ganesh Pal wrote: Yes. Just assert each thing as it needs asserting. Asserting each sub test will fail the entire test, I want the to pass the test if any the sub test passes. If the sub test fail try all cases and fail for the last one. Example : def test_th

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread MRAB
On 2017-07-19 09:29, Marko Rauhamaa wrote: Gregory Ewing : Marko Rauhamaa wrote: * a final "v" receives a superfluous "e" ("love") It's not superfluous there, it's preventing "love" from looking like it should rhyme with "of". I'm pretty sure that wasn't the original motivation. If I had

Re: Best way to assert unit test cases with many conditions

2017-07-19 Thread Terry Reedy
On 7/19/2017 8:24 AM, Peter Otten wrote: Ganesh Pal wrote: (1) I would want my subtest to have a *Condition* based on which it that would pass my entire test if any of the sub-test passed. If I understand correctly, you want assertTrue(subtest1 or subtest2 or subtest3 or subtest4 ...) o

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Thomas Jollans
On 19/07/17 04:19, Rustom Mody wrote: > On Wednesday, July 19, 2017 at 3:00:21 AM UTC+5:30, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> Let me give you one concrete example: the letter "ö". In English, it >>> is (very occasionally) used to indicate diaeresis, where a pair of >>> letters is not

Re: Problem in installing module "pynamical"

2017-07-19 Thread Felipe Bastos Nunes
Hi! I have no experience on that, but I may ask something that might help: 1- are you aware that it's not safe to use pip directly? It could be safer to use pip install --user package. 2- Are you able to use virtualenv? This usually let me install packages my system has problems on working out. Cy

Re: rpy2

2017-07-19 Thread Felipe Bastos Nunes
Hey, I have no experience on it, but maybe I'm able to help. How are you tryin to install it? Pip? 2 or 3? Virtualenv? Cya! Em qua, 19 de jul de 2017 10:22, Larry Martell escreveu: > Anyone here any experience with the rpy2 package? I am having trouble > getting it to install, and I have posted

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Chris Angelico
On Thu, Jul 20, 2017 at 1:45 AM, Marko Rauhamaa wrote: > So let's assume we will expand str to accommodate the requirements of > grapheme clusters. > > All existing code would still produce only traditional strings. The only > way to introduce the new "super code points" is by invoking the > str.c

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Marko Rauhamaa
Chris Angelico : > Now, this is a performance question, and it's not unreasonable to talk > about semantics first and let performance wait for later. But when you > consider how many ASCII-only strings Python uses internally (the names > of basically every global function and every attribute in ev

SIGSEGV and SIGILL inside PyCFunction_Call

2017-07-19 Thread Anders Wegge Keller
I have an ongoing issue with my usenet setup. I'm that one dude who don't want to learn perl. That means that I have to build inn from source, so I can enable the python interpreter. That's not so bad, and the errors that show up have been something that I have been able to figure out by myself. A

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Random832
On Tue, Jul 18, 2017, at 22:49, Steve D'Aprano wrote: > > What about Emoji? > > U+1F469 WOMAN is two columns wide on its own. > > U+1F4BB PERSONAL COMPUTER is two columns wide on its own. > > U+200D ZERO WIDTH JOINER is zero columns wide on its own. > > > What about them? In a monospaced font, th

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Random832
On Tue, Jul 18, 2017, at 19:21, Gregory Ewing wrote: > Random832 wrote: > > What about Emoji? > > U+1F469 WOMAN is two columns wide on its own. > > U+1F4BB PERSONAL COMPUTER is two columns wide on its own. > > The term "emoji" is becoming rather strained these days. > The idea of "woman" and "pers

Re: rpy2

2017-07-19 Thread Larry Martell
On Wed, Jul 19, 2017 at 10:49 AM, Felipe Bastos Nunes wrote: > Hey, I have no experience on it, but maybe I'm able to help. How are you > tryin to install it? Pip? 2 or 3? Virtualenv? python2.7, using pip, on Redhat 6, R version 3.3.3: Collecting rpy2 Using cached rpy2-2.8.6.tar.gz Requirement

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Chris Angelico
On Wed, Jul 19, 2017 at 11:42 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> Perhaps we don't have the same understanding of "constant time". Or >> are you saying that you actually store and represent this as those >> arbitrary-precision integers? Every character of every string has to >> be a

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Marko Rauhamaa
Grant Edwards : > On 2017-07-19, Gregory Ewing wrote: >> Grant Edwards wrote: >>>vacuum, continuum, squush, fortuuned >> >> Fortuuned? Where did you find that? > > It was in the scowl-7.1 wordlist I had laying around: > > http://wordlist.aspell.net/ > > However, the scowl website now claims

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Grant Edwards
On 2017-07-19, Gregory Ewing wrote: > Grant Edwards wrote: >>vacuum, continuum, squush, fortuuned > > Fortuuned? Where did you find that? It was in the scowl-7.1 wordlist I had laying around: http://wordlist.aspell.net/ However, the scowl website now claims not to know about it: http:/

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Marko Rauhamaa
Chris Angelico : > Perhaps we don't have the same understanding of "constant time". Or > are you saying that you actually store and represent this as those > arbitrary-precision integers? Every character of every string has to > be a multiprecision integer? Yes, although feel free to optimize. Th

rpy2

2017-07-19 Thread Larry Martell
Anyone here any experience with the rpy2 package? I am having trouble getting it to install, and I have posted to the rpy mailing list, put a question on SO, and even emailed the author, but I have received no replies. Before I post details I wanted to see if anyone here can possibly help me. -- h

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Chris Angelico
On Wed, Jul 19, 2017 at 10:13 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Wed, Jul 19, 2017 at 7:53 PM, Marko Rauhamaa wrote: >>> Here's a proposal: >>> >>>* introduce a building (predefined) class Text >>> >>>* conceptually, a Text object is a sequence of "real" characters >>> >

Re: Best way to assert unit test cases with many conditions

2017-07-19 Thread Peter Otten
Ganesh Pal wrote: > On Tue, Jul 18, 2017 at 11:02 PM, Dan Strohl wrote: > >> >> Like this: >> >> Def test_this(self): >> For i in range(10): >> with self.subTest('test number %s) % i): >> self.assertTrue(I <= 5) >> >> With the subTest() method, if anything within that sub

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Marko Rauhamaa
Chris Angelico : > On Wed, Jul 19, 2017 at 7:53 PM, Marko Rauhamaa wrote: >> Here's a proposal: >> >>* introduce a building (predefined) class Text >> >>* conceptually, a Text object is a sequence of "real" characters >> >>* you can access each "real" character by its position in O(1)

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Chris Angelico
On Wed, Jul 19, 2017 at 7:53 PM, Marko Rauhamaa wrote: > Here's a proposal: > >* introduce a building (predefined) class Text > >* conceptually, a Text object is a sequence of "real" characters > >* you can access each "real" character by its position in O(1) > >* the "real" charac

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Rhodri James
On 19/07/17 09:17, Steven D'Aprano wrote: On Tue, 18 Jul 2017 16:37:37 +0100, Rhodri James wrote: (For the record, one of my grandmothers would have been baffled by this conversation, and the other one would have had definite opinions on whether accents were distinct characters or not, followed

Re: Best way to assert unit test cases with many conditions

2017-07-19 Thread Ganesh Pal
> > Yes. Just assert each thing as it needs asserting. > > Asserting each sub test will fail the entire test, I want the to pass the test if any the sub test passes. If the sub test fail try all cases and fail for the last one. Example : def test_this(self): if Sub_test_1(): #p

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Marko Rauhamaa
Chris Angelico : > To be quite honest, I wouldn't care about that possibility. If I could > design regex semantics purely from an idealistic POV, I would say that > [xyzã], regardless of its encoding, will match any of the four > characters "x", "y", "z", "ã". > > Earlier I posted a suggestion tha

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Steven D'Aprano
On Tue, 18 Jul 2017 10:11:39 -0400, Random832 wrote: > On Fri, Jul 14, 2017, at 04:15, Marko Rauhamaa wrote: >> Consider, for example, a Python source code >> editor where you want to limit the length of the line based on the >> number of characters more typically than based on the number of pixe

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Steven D'Aprano
On Tue, 18 Jul 2017 16:37:37 +0100, Rhodri James wrote: > (For the record, one of my grandmothers would have been baffled by this > conversation, and the other one would have had definite opinions on > whether accents were distinct characters or not, followed by a > digression into whether "ŵ" and

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Marko Rauhamaa
Gregory Ewing : > Marko Rauhamaa wrote: >> * a final "v" receives a superfluous "e" ("love") > > It's not superfluous there, it's preventing "love" from looking like > it should rhyme with "of". I'm pretty sure that wasn't the original motivation. If I had to guess, the reason was the possible v

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Marko Rauhamaa
Gregory Ewing : > Marko Rauhamaa wrote: >>> * the final consonant of a single-syllable word is doubled only if the >>> consonant is "k", "l" or "s" ("kick", "kill", "kiss") >> >> ... or "f" ("stiff") or "z" ("buzz") > > or sometimes "r" ("burr"), or "t" ("butt"). Those are exceptions. The orto

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Gregory Ewing
Marko Rauhamaa wrote: For all we know, someone somewhere might be cooking up a language that depends on "q̈". It makes perfectly good sense to me. It's the second derivative of q with respect to time. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Gregory Ewing
Marko Rauhamaa wrote: * "v" is never doubled ("shovel") Except for all the words that Grant listed before. * a final "v" receives a superfluous "e" ("love") It's not superfluous there, it's preventing "love" from looking like it should rhyme with "of". (Of course you just have to know th

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Chris Angelico
On Wed, Jul 19, 2017 at 4:49 PM, Steven D'Aprano wrote: > The *really* tricky part is if you receive a string from the user > intended as a regular expression. If they provide > > [xyzã] > > as part of a regex, and you receive ã in denormalized form > > U+0061 LATIN SMALL LETTER A + U+0303 COMBINI

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Gregory Ewing
Marko Rauhamaa wrote: * the final consonant of a single-syllable word is doubled only if the consonant is "k", "l" or "s" ("kick", "kill", "kiss") ... or "f" ("stiff") or "z" ("buzz") or sometimes "r" ("burr"), or "t" ("butt"). -- Greg -- https://mail.python.org/mailman/listinfo/python-lis

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Gregory Ewing
Grant Edwards wrote: vacuum, continuum, squush, fortuuned Fortuuned? Where did you find that? Google gives me a bizarre set of results, none of which appear to be an English dictionary definition. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to assert unit test cases with many conditions

2017-07-19 Thread Ganesh Pal
On Tue, Jul 18, 2017 at 11:02 PM, Dan Strohl wrote: > > Like this: > > Def test_this(self): > For i in range(10): > with self.subTest('test number %s) % i): > self.assertTrue(I <= 5) > > With the subTest() method, if anything within that subTest fails, it won't > stop the

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Steven D'Aprano
On Wed, 19 Jul 2017 17:51:49 +1200, Gregory Ewing wrote: > Chris Angelico wrote: >> Once you NFC or NFD normalize both strings, identical strings will >> generally have identical codepoints... You should then be able to use >> normal regular expressions to match correctly. > > Except that if you