4 ms·
once you start importing more packages, you easily end up with 100+ ms startup time
by drdrey 2y ago
once you start importing more packages, you easily end up with 100+ ms startup time
- robertlagrant 2y agoAt that point you're far beyond a bash script alternative though, aren't you?
- ComputerGuru 2y agoNot necessarily. Shell scripts often embody the unix “do one thing and do it right” principle. To download a file in a bash script you wouldn’t (sanely) source a bash script that implements an http client;, you would just shell out to curl or wget. Same for parsing a json file/response: you would just depend on and defer to jq. Whereas in python you could do the same but most likely/idiomatically would pull in the imports to do that in python. It’s what makes shell scripts so fast and easy for a lot of tasks.
- robertlagrant 2y agoFair enough, although in your examples Python comes with JSON support, but not a (very usable) HTTP client, and Bash has the reverse problem. I would like it if Python just had a sane nice HTTP client built in, but it can also just shell out to curl.