4 ms·
Oneshell is indeed a useful thing to keep in mind, but it's mostly when you want to retain state between commands; why would it be more relevant to python than
by tpoacher 4y ago
Oneshell is indeed a useful thing to keep in mind, but it's mostly when you want to retain state between commands; why would it be more relevant to python than other languages?
- Izkata 4y ago...you used python as the example.
- tpoacher 4y agoYes, and your comment seemed to imply that state between commands in make recipes (and thus use of oneshell) is somehow more important with a python shell than with the default bash shell. And I'm curious why you say this, as I wouldn't have thought it to necessarily be the case, so I thought perhaps you had some nice insight about the use of python as a make shell that I hadn't considered.
- Izkata 4y agoJust because with default (ba)sh recipes it's usually unnecessary, to the point where people are surprised when learn make does this. You're working directly on files so you don't need to carry any state in memory across lines. With python, this isn't really possible - even the most basic "open a file and write a value" spans two lines with state, so you need to write it in an unusual way, use backslashes to escape the newline, or use ONESHELL.