3 ms·
> Some examples might help here. I mostly script things so my programs are generally the type that are a bit too complicated for bash. Python makes this type o
by Dobbs 16y ago
> Some examples might help here.
I mostly script things so my programs are generally the type that are a bit too complicated for bash. Python makes this type of programming difficult.
For example. I want to run a command and get its output back. I'm then going to go and parse the output and preform transformations on it.
In order to accomplish this I have to use popen to open multiple pipes to the program and then read all of its output. I feel like I'm writing C.
> Python uses if/else, hashtables, OO constructs instead
Both if/else and hashtables are dirty hacks. Neither allows clean code. OO constructs can work but require large amount of setup to preform a simple task like parsing getopts.
> Python has lambdas, but their usage is discouraged in preference of explicit code blocks and named functions. You can use them if you must.
You are correct. I replied to another person's comment but haven't/won't edit my previous post.
> The indentation level of your statements is significant, but not whitespace in general
My apologies for using common terminology for significant indentation, significant indentation is what I meant. Either way I (subjective) dislike it. I personally find it harder to read than braces or ruby's end.
> Some people find Python usable for system administration.
I will strongly disagree here. I've tried to use Python on several occasions for system administration.
> There is a book "Python for Unix and Linux System Administration" (2008)
I'll check it out maybe it will show me somethings that change my views.
A lot of this is entirely subjective. At least for my type of work I find Python to be an annoyance more than a helper.
Though to be fair I find all languages to be pretty ugly/nasty when you take then out of their designed use.
- xiongchiamiov 16y agoPython is my language of choice for most things. That being said, it's not really a good choice for text processing (that is, using regular expressions) or glue scripts - I find Ruby to be an excellent successor to Perl for those. For anything that I expect to be maintained, especially by someone else, I tend towards Python, though, because the language seems geared towards that. Significant indentation is nice because your code does what it looks like it does. Docstrings are a godsend. The approach to modules and namespaces is quite helpful. Named arguments to functions prevent silly ordering mistakes. I just finished writing up my thoughts on this in a bit of a longer form. You can read them at http://changedmy.name/2011/02/16/why-pythons-modules-are-badass.html http://changedmy.name/2011/02/16/why-pythons-modules-are-bad... , if you like. I'm well aware that I'm not the best writer, nor am I the most educated or experienced person in this field, so any criticism is welcome.