is list comprehension necessary?

John Nagle nagle at animats.com
Tue Oct 26 12:29:04 EDT 2010


On 10/26/2010 2:31 AM, Xah Lee wrote:
> recently wrote a article based on a debate here. (can't find the
> original thread on Google at the moment)
>
> • 〈What's List Comprehension and Why is it Harmful?〉
> http://xahlee.org/comp/list_comprehension.html
>
> it hit reddit.
> http://www.reddit.com/r/programming/comments/dw8op/whats_list_comprehension_and_why_is_it_harmful/
>
> though, i don't find the argument there informative.
>
> For python, i can understand that it might be preferred, due to the
> special syntax, being more in sync with python because of the
> imperative hints in keywords. (e.g. those “for”, “if” in it.) But for
> more pure functional lang (e.g. haskell), i think lc is pretty bad.

    That's from the functional programming crowd.

    Python isn't a functional language.  It has some minimal
functional capabilities, and there's a lobby that would like
more.  So far, that's mostly been resisted.  Attempts to allow
multiline lambdas have been averted.  The weird "functional if"
syntax additions were a cave-in to the functional crowd, and may
have been a mistake.

				John Nagle



More information about the Python-list mailing list