[TriLUG] Do a lot of you program in Python?
Igor Partola
igor at igorpartola.com
Wed Jan 8 20:01:39 EST 2014
To pile on somewhat, Python has its flaws. It is certainly good enough for production quality code, but as a language lacks a couple of features that I think would make it a really nice language.
First, anonymous functions would be great. I am not talking about lambdas, but actual real multi-statement functions without names. This doesn't come up often but there are cases (like writing decorators) that could really benefit from this feature.
Along the same lines, closures in Python are kind of lame ducks. You always close over the global scope but it is read only, unless you declare it not to be so. Once again, it is rare to have to use them, but when you do, it can be a pain.
One big feature I would love to see is programming by contract built into the language. Currently, there are libraries that make this happen but none of them agree on exactly how to implement it, and most lack features. Since Python is duck typed having contracts would be fantastic.
Lastly, when you have a memory leak in Python you are in deep trouble as analyzing a complex Python program's memory usage is not easy.
The often cited GIL is actually a very specific and often misunderstood feature which should not prevent anyone from adopting the language. Other interpreters often have it too (Ruby being a prime example).
I make a living writing mostly Python code and so far it has not let me down so please don't take this criticism as a reason not to use Python. However, if you are already working with Common Lisp or Haskell, you probably won't find much new here as a language.
Oh, and if you can, write your project in Python 3. It is a nicer language than 2.7 though some libraries still aren't available.
Igor
P.S.: If you are into staticky typed languages but like Python, check out Nimrod (http://nimrod-lang.org)
More information about the TriLUG
mailing list