Stack Overflow moderator “animuson”

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Jul 10 13:15:20 EDT 2013


On Wed, 10 Jul 2013 16:54:02 +0100, Joshua Landau wrote:

> On 10 July 2013 10:00, Steven D'Aprano <steve at pearwood.info> wrote:
>> On Wed, 10 Jul 2013 07:55:05 +0000, Mats Peterson wrote:
>>
>>> 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.
> 
> I hate to sound like this but do you realise that this is exactly what
> you're arguing for when saying that sum() shouldn't use "+="?

You're referencing an off-list conversation, which will probably confuse 
most others reading this.

I don't agree with that. Apart from one throw-away comment where I said 
that sometimes it is handy to have a trivial example of an O(N**2) 
algorithm for teaching purposes, I have never made any suggestion that 
having sum(lists) be slow was a good thing in and of itself. My argument 
has always been that there are costs as well as benefits to changing sum 
of lists to use += instead of + and I'm not convinced that the benefits 
outweigh those costs.

Quite frankly, looking at the pure-Python version of sum that Sergey has 
posted, I *really* hope he is a better C programmer than Python 
programmer, because his pure-Python version is so full of bugs it is 
ridiculous.  But now I'm also referring to posts off-list :-)



-- 
Steven



More information about the Python-list mailing list