2 ms·
> Neither Python nor Java have REPL, or can have it in principle Python certainly can have it in principle; its true that there are structures that where __rep
by dragonwriter 3y ago
> Neither Python nor Java have REPL, or can have it in principle
Python certainly can have it in principle; its true that there are structures that where __repr__() doesn't feed back — that’s true in most Lisps for certain things, like recursive structures, too — but, too the extent that is worse than Lisp, that’s not an “in principle” limit.
Now, its true that the default Python interactive shell does not make it easy to distinguish between side effect printing and evaluation results, and worse yet (for use as a REPL) swallows rather than displaying None when it is a result, but “the default interactive shell is not a REPL” is very different than “Python cannot have a REPL in principle”.
- crabbone 3y agoAgain, Python cannot have REPL in principle because like half of the language isn't even printable... you don't have anything to attach your __repr__() to. Most Python code either doesn't produce any values worth evaluating further (i.e. None) or produces values that are impossible to convert back to executable code (a lot of the stuff in the "standard" library produces non-actionable "decoration" style renderings, eg.: >>> import socket >>> socket.socket() <socket.socket fd=3, family=2, type=1, proto=0, laddr=('0.0.0.0', 0)> You'd have to rewrite over half of the "standard" library to make it print something reasonable, and why would you at that point call the resulting language "Python"?