
A goliath of automated theorem proving <https://link.springer.com/chapter/10.1007/978–3–030–51054–1_9|wants to teach the basics>:
> Python is a high-level multi-paradigm programming language that combines both imperative and functional programming with an object-oriented inheritance system. It includes a variety of built-in data types, including lists, associative arrays/hashes and even sets. It shares dynamic typing/polymorphism, lambdas, and a built-in list datatype with LISP, one of the classical languages for symbolic AI and theorem proving. This enables us to implement both terms, the most frequent data type in a saturating prover, and atoms, as simple nested lists (s-expressions), using Python’s built-in strings for function symbols, predicate symbols, and variables. But… but… why Python then?!! :sob:

As an aside, does anyone know the historical origins of duck-typing/dynamic-dispatch in Python? I’m trying to track it down but am having some trouble.

Also the mutable global
scope system.

I hate Python’s scope and lambda. Those are probably the only reasons I don’t use it more.

Also, it compares Python list with lisp list? Hmm…

Yeah, this is a little sad. But clearly any kind of efficiency wasn’t at stake here: """
Return the largest literal among those with the smallest
variable list.
"""
assert(litlist)
litlist.sort(key=varSizeEval)
return litlist[0:1]
my eyes…

I do like Python despite its warts but it does seem to go out of the way to make immutable functional style hard.

There are some third party libs like attrs that make it a bit better.

I actually like ‘python’ to write pseudo code in my papers, it’s nicely compact line-wise :smile:

Apparently Gavin van Rossum basically hates functional programming (or, certainly recursion, at least), which explains some of Python’s choices…
Coconut (https://coconut-lang.org/) was created to make a much nicer FP version of Python that transpiles to regular Python, but it doesn’t ever seem to have taken off.

As to why Python? Probably lots of reasons, most of them not great, but I imagine the dominant one would be simply that sooooo many programming schools, bootcamps and CS departments at university use Python as their introductory language these days. And, as the saying goes, “If the mountain won’t come to Mohammed, then Mohammed will have to go to the mountain”.

I don’t think Guido van Rossum understands functional programming nor does he want to. I’ve read interviews of him, and it seems he equates functional programming with Haskell. As Racket and F# attest, functional programming is much more broad. A little of SML and Scheme sprinkled on Python would have basically fixed a lot of its warts (the scoping and lambda systems).
I’m generally not a fan of his attitude, and it permeates some of the community. Working in industry, it’s impossible to nudge Python programmers towards other systems, which makes life rather tough. It’s assume to be the de facto language, and this is also one reason why I am suspect of the Rhombus project having any appreciable affect on Racket adoption.