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 16:10:47 EDT 2014
Steven D'Aprano <steve+comp.lang.python at pearwood.info>:
> On Sun, 06 Apr 2014 12:05:16 +0300, Marko Rauhamaa wrote:
>> Python, BTW, is perfectly suitable for computer science.
>
> I don't think it is. Python is not a pure functional language, so it's
> very difficult to prove anything about the code apart from running it.
Many classic CS ideas are expressed in terms of an Algol-like language.
Nothing would prevent you from framing those ideas in a Python-like
(pseudo)language. The question is mostly whether you prefer begin/end,
braces or indentation.
>> * combinatory birds in forests
>
> I don't believe that came from academia. If I've understood correctly,
> that was from a non-academic book on applying the lambda calculus to
> solve practical applications.
It is academic because the author, Raymond Smullyan, was a professor of
philosophy and, more importantly, my professor selected that as a
textbook for us graduate students.
Marko
More information about the Python-list
mailing list