5 ms·
I doubt I'm the only one but I really don't like python. Python makes simple things hard. It has no switch statements, no lambdas. It has significant white spa
by Dobbs 16y ago
I doubt I'm the only one but I really don't like python.
Python makes simple things hard. It has no switch statements, no lambdas. It has significant white space (I've tried and tried but I can't get over it).
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.
On a side note I greatly prefer go's approach to white space. It's not significant but there is a piece of software that rewrites code to the "standard".
- elithrar 16y agoPython certainly has lambdas[1], and they're very 'typical' lambdas at that. [1]: http://www.secnetix.de/olli/Python/lambda_functions.hawk http://www.secnetix.de/olli/Python/lambda_functions.hawk
- Dobbs 16y agoYou are correct and I mistyped. Python has limited lambdas not a lack of lambdas.
- 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.
- irahul 16y ago> It has no switch statements, Opinionated langauge. You either use a if-elif ladder or use a dictionary to switch. I use dictionaries most of the times; not trying to defend lack of switch here but table driven code tends to be less fragile. > It has significant white space Significant indent. The only problems I have ever found with this is when I copy paste code in vim and try to auto-indent. Sometimes when the copy is not properly indented, it goes awry. The limited lambdas are related to this. Other than copy pasting code and limited lambda as a related consequence, I can't think of any other issues it might cause. > use it to replace the scripting I have to do on a day in and day out purpose. Why would you necessarily want to do it? I assume you mean shell pipelines when you say command line scripts. Shell scripts, if you are on *nix, suit a particular class of problems very well. Sure Ruby and Perl play nicely with command line scripts and I have worked on Perl & am familiar with Ruby, but I seldom resort to them - if it's a shell pipeline, sed,awk,grep and co are summoned. If it grows beyond that, then I open vim and write perl/python re-using the pipeline and adding some logic.
- xiongchiamiov 16y agoPython makes simple things hard. It also makes some slightly complicated things really easy, mostly by way of an incredibly extensive standard library. One line for a static webserver (python -m SimpleHTTPServer). Not that much more to extend it. On a side note I greatly prefer go's approach to white space. It's not significant but there is a piece of software that rewrites code to the "standard". Go's bracing, though... http://news.ycombinator.com/item?id=1912986 http://news.ycombinator.com/item?id=1912986 . Talk about not making wrong code look wrong.
- Dobbs 16y agoI took a look at the complaint with Go's bracing and it seemed like a bug. Put in a bug report and they responded positively and have since corrected the issue. Newest versions of Go do not exhibit this issue.