is list comprehension necessary?

rantingrick rantingrick at gmail.com
Wed Oct 27 00:25:00 EDT 2010


On Oct 26, 11:29 am, John Nagle <na... at animats.com> wrote:
> 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_compreh...
>
> > 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

I think if you look at LC's (Python's LC's that is) from an esoteric
and mainstream (almost haughty) point of view then yes they will seem
offensive to you. However i think Guido and his cast of extras (if I
may speak on behalf of this fine group of folks!) intended LC's to be
like any other construct we have come to love about Python. Syntactic
simplicity coupled with elegant phrasing whist never forgetting to
drop a good joke when the situation permits (as is the case for the
easter eggs and whatnot). So my point is that Python LC's are
different from "mainstream" LC's and that is a good thing. I find
Pythons map and lambda far more atrocious than LC's , really.




More information about the Python-list mailing list