Drgn: A programmable C debugger, scriptable from Python
github.com
github.com
Drgn: How the Linux kernel team at Facebook debugs the kernel at scale - https://news.ycombinator.com/item?id=29537594 - Dec 2021 (125 comments)
You are correct about it being fiddly to write multi-line Python scripts at the REPL.
However:
- Modern python REPLs are really good. They auto-complete very well and suggest indentation when they recognise the syntax of the previous line:
```
$ python3
>>> for x in range(1, 10):<user presses enter key>
....<indentation is provided by REPL, note the "....">
```
- Python indentation rules are quite simple once you get the hang of it
- The issue with typing at the REPL is really more about remembering the syntax of various language statements rather than the white space rules of Python. This is a problem with using any (other language) like, say, Lua/Javascript at the REPL.
- Most "scripts" at the REPL tend to be just a single line where you don't need to worry about whitespace indentation. When you have a long script then you simply run a program directly
- Yes, Python scripting at the REPL is a bit more verbose than Javascript (for example). But most people can live with the extra characters and the verbosity makes it easier to understand what you meant a few REPL commands ago
- The reason to use Python generally its insanely large ecosystem of software. The inconvenience of the white-space-significant aspect of language at the REPL is totally offset by that.
Nobody just not true, and also overdramatizing at the whitespaces, lol. Taking the expressiveness over C anytime, and also over Javascrpt's uglyness and insanities. What's your fav then?
A newcomer will have a hard time replacing it.
If you try iPython + a PYTHONSTARTUP script, it will be very hard to use anything else.
And ipdb is a very good example of using a debugger that fully benefit from that.
So it is entirely possible to have an exceptionnally good experience in a Python REPL, despite the significant whitespaces, but it does depend of the implementation.