laurent.orseau
2021-2-5 17:41:19

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:


yilin.wei10
2021-2-5 18:03:01

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.


yilin.wei10
2021-2-5 18:03:19

Also the mutable global scope system.


sorawee
2021-2-5 20:46:56

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


sorawee
2021-2-5 20:48:05

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


laurent.orseau
2021-2-5 20:49:25

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…


samdphillips
2021-2-5 20:50:59

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


samdphillips
2021-2-5 20:51:20

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


laurent.orseau
2021-2-5 20:52:00

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


jcoo092
2021-2-5 22:31:42

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.


jcoo092
2021-2-5 22:34:25

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”.


bmitchell33
2021-2-6 02:11:47

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.