List Comprehension, Python, Semantics and Syntax, and the Hacker Idiocies

By Xah Lee. Date: .

list comprehension, python, semantics and 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: List Comprehension

list comprehension is no good. see Why List Comprehension is Bad

still, the python hacker idiots 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 (For example, 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 http://reference.wolfram.com/language/ref/Table.html, 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, idiots 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 idiotic i am, also ran is my very advanced feature the list comprehension, witness.”.