Re: [Python-ideas] This seems like a wart to me...

Mike Meyer writes:
Yeah, it's "[][)(^-]". So much for complexity of the needed regexp (see below for difficulty of composition).
They're hardly write-once in this context. The above regexp is hard to write, agreed, because you have to remember to move the close bracket to the start, the hyphen to the end, and the caret away from the start. (Note that there is never a need to put the close bracket and hyphen in other positions, so this is not a particularly hard rule to remember IMO YMMV.) However, precisely because of the oddity of the positions of the close bracket and hyphen it's easy enough to read once you've learned to write it. As far as I can see, that is the hardest regexp that most people will ever want to write for re.split(). Again, I just don't see that (limited) use of regular expressions makes programs harder to read or write than proliferating special case functions that provide nowhere near the power of a single regular expression-based function.

On Sat, Dec 13, 2008 at 8:48 AM, Stephen J. Turnbull <stephen@xemacs.org> wrote:
A lot of it is evil by association — we're taught that regex is evil and should never be used — only later do we figure out that regex is often the best tool regardless of being evil. In this case the docs are pretty overwhelming for the minor task. A simple "this is all you need for this task" tutorial might help. -- Adam Olsen, aka Rhamphoryncus

On Sat, Dec 13, 2008 at 8:48 AM, Stephen J. Turnbull <stephen@xemacs.org> wrote:
A lot of it is evil by association — we're taught that regex is evil and should never be used — only later do we figure out that regex is often the best tool regardless of being evil. In this case the docs are pretty overwhelming for the minor task. A simple "this is all you need for this task" tutorial might help. -- Adam Olsen, aka Rhamphoryncus
participants (2)
-
Adam Olsen
-
Stephen J. Turnbull