Stack Overflow moderator “animusonâ€

M

Mats Peterson

A moderator who calls himself “animuson†on Stack Overflow doesn’t
want to face the truth. He has deleted all my postings regarding Python
regular expression matching being extremely slow compared to Perl.
Additionally my account has been suspended for 7 days. Such a dickwad.

Mats
 
M

Mats Peterson

Chris Angelico said:
And this matters... how? What are we supposed to do about it? We are
not the Python Secret Underground, which emphatically does not exist.

ChrisA

You aren’t supposed to do squat about it. I just wanted to mention it
to the Python evangelists, who need to see the light.

Mats
 
S

Steven D'Aprano

And this matters... how? What are we supposed to do about it? We are not
the Python Secret Underground, which emphatically does not exist.

Of course not, because if it did
 
M

Mats Peterson

Chris Angelico said:
And this matters... how? What are we supposed to do about it? We are
not the Python Secret Underground, which emphatically does not exist.

ChrisA

I fear you don’t even know what a regular expression is. Then this of
course won’t affect you whatsoever.

Mats
 
M

Mats Peterson

Chris Angelico said:
Your post hits me squarely between the eyes, leaving an "Uhh?"-shaped hole.

ChrisA

I fear you don’t even know what a regular expression is. Then this will
of course not affect you.

Mats
 
C

Chris Angelico

You aren’t supposed to do squat about it. I just wanted to mention it
to the Python evangelists, who need to see the light.

Your post hits me squarely between the eyes, leaving an "Uhh?"-shaped hole.

ChrisA
 
M

Mats Peterson

Chris Angelico said:
Then they would have full control of this list and what gets pos

Ahhh.... so this is pos, right? Telling the truth? Interesting.
 
M

Mats Peterson

Chris Angelico said:
Then they would have full control of this list and what gets pos

Have you ever compared the regular expression performance between Perl
and Python? If not, keep quiet.

Mats
 
S

Steven D'Aprano

A moderator who calls himself “animuson†on Stack Overflow doesn’t want
to face the truth. He has deleted all my postings regarding Python
regular expression matching being extremely slow compared to Perl.

That's by design. We don't want to make the same mistake as Perl, where
every problem is solved by a regular expression:

http://neilk.net/blog/2000/06/01/abigails-regex-to-test-for-prime-numbers/

so we deliberately make regexes as slow as possible so that programmers
will look for a better way to solve their problem. If you check the
source code for the re engine, you'll find that for certain regexes, it
busy-waits for anything up to 30 seconds at a time, deliberately wasting
cycles.

The same with Unicode. We hate French people, you see, and so in an
effort to drive everyone back to ASCII-only text, Python 3.3 introduces
some memory optimizations that ensures that Unicode strings work
correctly and are up to four times smaller than they used to be. You
should get together with jmfauth, who has discovered our dastardly plot
and keeps posting benchmarks showing how on carefully contrived micro-
benchmarks using a beta version of Python 3.3, non-ASCII string
operations can be marginally slower than in 3.2.

Additionally my account has been suspended for 7 days. Such a dickwad.

I cannot imagine why he would have done that.
 
I

Ian Kelly

You aren’t supposed to do squat about it. I just wanted to mention it
to the Python evangelists, who need to see the light.

It's well known that regular expressions are slow. I wouldn't know
how they compare to Perl, which I don't use.
 
M

Mats Peterson

Chris Angelico said:
I know what regular expressions are. I've used them in Perl, PHP,
JavaScript, Python, C++, Pike, and numerous text editors (which may
have been backed by one of the above languages, or may have been
something else). Doesn't change the fact that I have no idea what the
significance is of your post.

ChrisA

You do? And you haven't noticed the inferior performance of regular
expressions in Python compared to Perl? Then you obviously haven't
used them a lot.

Mats
 
C

Chris Angelico

I fear you don’t even know what a regular expression is. Then this of
course won’t affect you whatsoever.

I know what regular expressions are. I've used them in Perl, PHP,
JavaScript, Python, C++, Pike, and numerous text editors (which may
have been backed by one of the above languages, or may have been
something else). Doesn't change the fact that I have no idea what the
significance is of your post.

ChrisA
 
M

Mats Peterson

Ian Kelly said:
Troll. A quick search of my Gmail archives turns up 18 threads in
which Chris has used the phrase "regular expression".

Not a troll. It's just hard to convince Python users that their beloved
language would have inferior regular expression performance to Perl.

Mats
 
I

Ian Kelly

I fear you don’t even know what a regular expression is. Then this of
course won’t affect you whatsoever.

Troll. A quick search of my Gmail archives turns up 18 threads in
which Chris has used the phrase "regular expression".
 
C

Chris Angelico

Have you ever compared the regular expression performance between Perl
and Python? If not, keep quiet.

I think I can see why you were suspended.

You and jmf should have a lot of fun together, I think.

ChrisA
 
I

Ian Kelly

Ahhh.... so this is pos, right? Telling the truth? Interesting.

I don't know what you mean by that, but since the joke appears to have
flown over your head, I'll explain it. Steven's "pos" was clearly
meant to be the word "posted", before his sentence got cut off by the
Python Secret Underground.
 
M

Mats Peterson

Ian Kelly said:
I don't know what you mean by that, but since the joke appears to have
flown over your head, I'll explain it. Steven's "pos" was clearly
meant to be the word "posted", before his sentence got cut off by the
Python Secret Underground.

Being snotty, are we?
 
C

Chris Angelico

You do? And you haven't noticed the inferior performance of regular
expressions in Python compared to Perl? Then you obviously haven't
used them a lot.

That would be correct. Why have I not used them all that much? Because
Python has way better ways of doing many things. Regexps are
notoriously hard to debug, largely because a nonmatching regex can't
give much information about _where_ it failed to match, and when I
parse strings, it's more often with (s)scanf notation instead - stuff
like this (Pike example as Python doesn't, afaik, have scanf support):
data="Hello, world! I am number 42.";
sscanf(data,"Hello, %s! I am number %d.",foo,x); (3) Result: 2
foo; (4) Result: "world"
x;
(5) Result: 42

Or a more complicated example:

sscanf(Stdio.File("/proc/meminfo")->read(),"%{%s: %d%*s\n%}",array data);
mapping meminfo=(mapping)data;

That builds up a mapping (Pike terminology for what Python calls a
dict) with the important information out of /proc/meminfo, something
like this:

([
"MemTotal": 2026144,
"MemFree": 627652,
"Buffers": 183572,
"Cached": 380724,
..... etc etc
])

So, no. I haven't figured out that Perl's regular expressions
outperform Python's or Pike's or SciTE's, because I simply don't need
them all that much. With sscanf, I can at least get a partial match,
which tells me where to look for the problem.

ChrisA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top