list comprehension, python, semantics & syntax, and the hacker idiocies

Guido wants to remove {lambda, map, reduce} in python. He wants us to use list comprehension exclusively. see Lambda in Python 3000.

if you don't know what list comprehension is, see Python Tutorial: List Comprehension

list comprehension is no good. see Computer Language Design: What's List Comprehension and Why is It Harmful?

still, the python hacker idts defend it by “its faster”. In which, python compiler idcy comes forward to defend python language idcy, like a snake eating its tail.

however, there's one important semantic advantage of list comprehension. That is, using expressions to build complicated list. The advantage is seen especially with multiple variables (⁖ nested array n levels deep, each level has different number of nodes.). This would be nested map, which is cumbersome. This is also why, Mathematica has the Table[] construct, which is a functional form of list comprehension. (in Common Lisp, the analogous is its loop. However, only Mathematica's syntax is functional. Python and Common Lisp loop syntax are imperative warts on drugs.)

by the way, idts will start to talk about list comprehension as analogous to math's set comprehension and stuff. U no unstand.

math's set comprehension notation is a idiocy, first of all. see:

or Google search for “calculational proof” by Dijkstra or others, or “calculational math”.

secondly, programing language's list comprehension has nothing to do with math's set notation, unless you are talking about purely declarative functional languages or proof system language that actually have some form of “comprehension”, such as coq or HOL, see:

by the way also, “list comprehension” is one of those fuzzy thing. Any lang that has a weird loop syntax can claim to have “list comprehension”. So, on pages such as Wikipedia, you have one hundred languages all trying to demo its list comprehension. Like, “regardless how idtc i am, also ran is my very advanced feature the list comprehension, witness.”.

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs