file_name_fixer.py

Steven D'Aprano steve at REMOVETHIScyber.com.au
Wed Jan 25 07:02:11 EST 2006


On Wed, 25 Jan 2006 10:37:12 +0000, Richie Hindle wrote:

> 
> [Fredrik]
>> so re.sub("([_.])\\1+", "\\1", newname) replaces runs consisting
>> of either a . or an _ followed by one or more copies of itself, with
>> a single instance of itself.
> 
> ...and this:
> 
>>>> def isprime(n):
>>>>     return n > 1 and not re.match(r'(xx+)\1+$', 'x'*n)
> 
> finds prime numbers.
> 
> I'll get me coat.


See, now that's exactly the sort of thing that makes me wake screaming
in the night. That's just deeply, deeply wrong -- I don't know what's
worse, that it *works*, or that somebody thought of it.

:-)

Thank you to Fredrik for trying to teach me something, but it is 11pm on
the night before a public holiday (Australia Day), my house feels like an
oven, and in the last three hours I've suddenly started coming down with a
cold -- in the middle of our summer. So this is not the time for me to try
to learn anything new.


-- 
Steven.




More information about the Python-list mailing list