[Python-ideas] More power in list comprehensions with the 'as' keyword
rrr at ronadam.com
Fri Aug 29 02:27:18 CEST 2008
Greg Falcon wrote:
> On Thu, Aug 28, 2008 at 1:41 PM, Ron Adam <rrr at ronadam.com> wrote:
>> Josiah Carlson wrote:
>>> The split/strip stuff is simple on purpose; it's fast. Tossing in
>>> regular expressions handling is a great way to slow down the general
>>> case, never mind if you actually want to split on the passed literal
>> That's easy to remedy without making it overly complex.
>>>> text.split_pattern(' *\n+ *')
> We're well off the original subject now, but what you propose can
> today be written
> re.split(' *\n+ *', text)
> which I'd argue is just as easy to remember as your proposed new
> method, and in fact reads better, as it's much easier to guess that
> regex matching is going on.
Who's arguing? ;-)
The main point is that extending the core syntax isn't needed. Extending
the library should be considered first.
More information about the Python-ideas