Strange regex problem

Rene Pijlman reply.in at the.newsgroup
Sun Mar 2 22:30:38 CET 2003


Gary Herron:
>I have just (last week) volunteered to take over maintenance of the
>regular expression code, so I'll think about fixing this, 

Great!

>but it's not clear to me what a fix should entail.
>
> * Document the flag.

Sure. But would it have helped in this case?

> * Ignore the flag.

I guess whatever it does is there for a reason.

> * Raise an exception for any flag bit other than the document flags.

That sounds like a good idea (assuming you're also going to
document all sensible bits of the flag :-) ), but it stil won't
catch all cases.

> * Others?

I don't think the undocumented flag is the real problem here. If
my understanding is correct, the documentation of search() on
compiled vs. uncompiled re's is somewhat confusing (see also
news:ej646vod013oreo6bvj8ctgdmumdmjjg16 at 4ax.com). So I think
that improving this documentation would probably be more
effective.

Also, this definitely proofs that Python's weak typing is not a
good idea. The standard reply "unit testing" obviously doesn't
work when a function/method behaves correctly, but is called
with wrong parameters. This would never have happened in Java.
;-)

-- 
René Pijlman




More information about the Python-list mailing list