4 ms·
> Python makes simple things hard. Some examples might help here. > It has no switch statements Python uses if/else, hashtables, OO constructs instead http:/
by d0mine 16y ago
> Python makes simple things hard.
Some examples might help here.
> It has no switch statements
Python uses if/else, hashtables, OO constructs instead http://www.python.org/dev/peps/pep-3103/ http://www.python.org/dev/peps/pep-3103/
> no lambdas.
Python has lambdas, but their usage is discouraged in preference of explicit code blocks and named functions. You can use them if you must.
>It has significant white space
The indentation level of your statements is significant, but not whitespace in general http://www.secnetix.de/olli/Python/block_indentation.hawk http://www.secnetix.de/olli/Python/block_indentation.hawk
> There is no simple way to drop down to the command line which means I can't easily use it to replace the scripting I have to do on a day in and day out purpose.
Some people find Python usable for system administration. There is a book "Python for Unix and Linux System Administration" (2008).
- 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.