3 ms·
perl I'd agreed with up to somewhere 2010. Python it is, these days, for maintainability. one shot quick regex things? sed. anything else python. and I don'
by froh 2y ago
perl I'd agreed with up to somewhere 2010.
Python it is, these days, for maintainability. one shot quick regex things? sed. anything else python.
and I don't say "switch", btw, if you're proficient I there is no value and no need ditching it.
however if you're new to the CLI game, then I'd _not_ suggest perl but python instead.
- kamaal 2y agoPython unfortunately still doesn't provide a lot of things like heredocs, qw, multiline lambdas, many other unixy things. Its regex capabilities are also not Perl standard. Scripting is a lot about text, but its not only about text. You need to neatly integrate with many other OS things. More importantly the language needs to be designed such that such tasks can be done with ease. Python is more like good a small application programming language. Not that great if you do heavy OS, text or command line interaction work. It feels like a less flexible Java in that regard.
- fluidcruft 2y agoMy experience (switching from heavy use of shell) is Python is really good at text processing and building data structure very quickly. Python is a bit wordy for small things but it become extremely concice and reusable once things get a tiny bit larger. Generally I find doing things in Python is straightforward whereas using shell is more of a low level puzzle game of conversions and reformats and fragility. The puzzles in Python are higher level using better data types and containers. But also it's much easier to wrap things up into modules and reuse code in Python. And yeah Python is slow... but not compared to bash (unless you're using things like parallel, but Python isn't necessarily horrible for that either) That's been my experience anyway.