3 ms·
having a hard time being sold here. mkdir -p would create the directory without error. checking if a directory exists is trivial before creating it. Python thr
by sigmonsays 5y ago
having a hard time being sold here.
mkdir -p would create the directory without error. checking if a directory exists is trivial before creating it. Python throws an error if the path given to os.mkdir exists too.
This article is way too long to digest, so i should stop now.
Perhaps the argument should be, rewrite hacky things in bash as programs and build them into your apps?
- rstuart4133 5y agoI've written a lot of bash scripts in my time, even some 10,000 liners. Christ - I have probably written over 100k lines of them. The big ones (by big I mean say over 100 lines) all started life when I thought they would remain under 100 lines. I'm a professional programmer by trade. Admitting to starting a program I know would be over 100 lines in shell script would be close to an admission of incompetence, because technically shell script is one of the worst computer languages out there. So I'd never admit to it. But it's so damned portable, and ubiquitous and the batteries it comes with (the 'nix cli tools) are to powerful and complete, it makes irresistible at times. Where this article falls down is they are recommending Python3. Python2 would be fine. But in 'nix environments, where file names and configuration files can't be treated as text (Unicode) because there is no well defined system encoding, Python3 manages to introduce more rare bugs than shell script. It encourages you to treat everything a text, the dies ignominiously when decoding the 'nix byte stream (file name or whatever) fails. (On Windows where everything is UTF16, this isn't a problem - for local files. It remains a problem for data from external systems, like the internet.) Pull off making a programming language less reliable than shell was a mean achievement - but the Python3 devs did it. Hats off to 'em.
- rawoke083600 5y ago>This article is way too long to digest, so i should stop now. Lol one of the top problems with having "scripts" in python, their reliability-lifetime" (a.k.a as execute-and-forget) is very limited. Packages are outdated, api changes etc etc