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

Bruce Leban bruce at leapyear.org
Sat Dec 13 21:14:07 CET 2008


[i for i in s.split(x) if i] is simple enough if I don't know how to write
"(" + re.escape(x) + ")+".

I would like to be able to drop "i for" in cases like this and just write [i
in s.split(x) if i].

--- Bruce

On Sat, Dec 13, 2008 at 12:05 PM, Carl Johnson <carl at carlsensei.com> wrote:

> I think this discussion is drifting from the point. We all agree that
> regexps are great and powerful and no professional programmer should fail to
> learn them. But at the same time, it's worth noting that they are a
> different language from Python proper, and it's very easy to get weird
> results without knowing why.
>
> Anyway, apparently the proposal to allow splitting on a list is dead. What
> do people think of the proposal to add a dropitem keyword to allow the
> dropping (or retaining) of empty results?
>
> -- Carl
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20081213/816cd211/attachment.html>


More information about the Python-ideas mailing list