2007 Jul 31 elly-miang

Guy Blade Guy Blade---03:54:00

Last Chance: Failure
Today, I gave Python its last chance. I know some people who are very strong advocates, and it is apparently rather popular at JPL. I have decided, however, that it is not worth using. This isn't due to the difficulty in programming in it--the simple things that I was trying to make today all worked fine--this is due to the idiotic language design choices made in it.

  • Implicit scoping - This has always been my main problem with the language. Today, my opinion was only reinforced by learning that Python defines the width of a tab character to be 8 characters. I am aware that this is the Unix standard width, but it is also completely unreasonable when most text editors created in, say, the last decade use a tabstop closer to 4 or 5 characters.
  • No ternary operator - The ternary operator is generally of the form ( condition ? trueval : falseval ) and is amazingly useful in the right situations--most notably for its ability to be used in other conditionals or as part of a compound assignment. There are work-arounds in python to get ternary style operation, but some require evaluation of all arguments (i.e., the (trueval, falseval)[conditional] method) and the new language construct added in Python 2.5 is ( trueval if condition else falseval ) which is just out of order.
  • No increment operators - These are simply your ++ and -- friends. The explaination for their absence is something along the lines of "they let you write code that's hard to read". Unfortunately, it is my firm belief that it is always possible to write code that's hard to read and one shouldn't throw out language constructs on that basis alone.
  • No explicit support for abstract classes - You can create things that are similar to abstract classes by creating methods without bodies. The problem comes in the fact that you can still instantiate a class with such methods and in fact you can call the methods without bodies. This leads to errors. I understand that the language is dynamically typed, but that doesn't mean that I should be able to instantiate anything willy-nilly.
  • print is not a function - print is a syntactic form with strange syntax. For instance, if you want to write a line without a carriage return, you have to end the print statement with a comma. Why? Who knows? You can use it like C's printf, but then its syntax becomes even stranger
  • Every function in a class must take the class as its first argument - That's right, when you declare a class function, it must take at least one argument, the instance of the class calling it. When you call the function though, you only provide it with values for the remainder of the arguments. For example, the function declared as def foo(self, blah, thing): would be called as foo(blahval, thingval). I'm sure there is a very good reason why they require every class function to have this argument, but whatever it is, the result is stupid.

There were other things that bothered me that I can't remember now, but I think this list is sufficient to get my point across. The language isn't a total wash--it at least has lambda expressions, but they alone are not sufficient to make me want to write anything in the language given its current handicaps.

Published by XPost

Permalink to this post     Com/0

Copyright 2002-2019 Blade Libergnosis//Powered By Blogger