Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

Marko Rauhamaa marko at pacujo.net
Sun Apr 6 05:05:16 EDT 2014


Mark H Harris <harrismh777 at gmail.com>:

> On 4/4/14 4:53 AM, Steven D'Aprano wrote:
>> Python is not a computer-science-ey language.
>
> Every programming language is interesting from a comp sci standpoint.
> Some are more useful for research; python is one of those.
>
> For what reasons do you disagree?

Computer science doesn't mean "anything related to computers."
Physicists typically couldn't care less about your heating up your lunch
in the microwave oven. Similarly, computer scientists aren't interested
in the mundane applications of their lofty research topics.

Python, BTW, is perfectly suitable for computer science. Normally,
though, you either use a pseudolanguage or some sort of formalism that
hasn't been implemented.

In theoretical computer science, they cherish off-the-wall models that
detach the topic from everyday applications. Here are examples that I
remember from graduate school:

 * combinatory birds in forests

 * unfaithful husbands on an island ruled by female logicians

 * dining philosophers getting into a deadlock over forks

 * Byzantine generals trying to agree on a surprise onslaught on a
   besieged city


Marko



More information about the Python-list mailing list