2 ms·
Again, 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. Mos
by crabbone 3y ago
Again, 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"?