Python 'sh' is so awesome.
It is a total hack, at least the way I use it.
But a wonderful hack.
I have done the following pattern so many times, because
once I'm in a REPL I don't want to leave.
```
import os
os.system("pip install sh")
..
from sh import ls
fs = ls("-1").split("\n")
```
'fs' is now a list of string of all the files in `pwd`.
---
The specific shell command isn't the point. The point is
you can grab anything, especially if you are already comfortable
in the shell. Like you want the ip address ? ...
```
from sh import ifconfig, grep
This is the wrong way to get an ip address in python. I don't care.
I was able to do that without referencing anything. Whatever code I'm
writing will work for now. I write so much throw away stuff that it
will probably not get used again. If it does the hack is basically
self-documenting. Like if you're gonna hack, put up flags. Call it
out.
If I saw this in a code review I'd reject it without hesitation, and
I still use this kind of pattern all of the time.
Does this exist in common-lisp ?
Playing with uiop:run-program made me think of this.
I had written some complex stanza to do something basic.
It was the wrong way to do it, but "I don't care". In my later
programming years, I am comfortable with my own definition of
"good code". And I am comfortable writing "bad code" if I want
to. I mean I am not afraid of developing bad habits anymore.
It's like grinding in skateboarding. It's arguably the most
satisfying trick. It's the "wrong" way to ride a skateboard.
The wheels are supposed to be the contact surface, not the
trucks. But once you are confident in not unlearning how to
ride on the wheels, yes riding on the trucks on a curb, with
all the loud scraping is wonderful.