Hacker News new | ask | show | jobs
by marvin 6683 days ago
The distinction interpreted/compiled is largely moot these days, since most popular interpreted languages are actually compiled (or at least bytecode-compiled) before they are run.

The real question is whether you would want to use a modern, abstract, weakly typed language like Python instead of a strongly typed and machine-code compiled language like C++. The latter is, usually, considerably slower. The decision all depends on how serious you want to get. For small-scale experiments, Python is just fine because it takes half the time and half the effort to write and test a piece of code. Unless you are pushing the limits on how fast you want something to run, Moore's law works in your favor and you can very quickly create something which does what you want and is fast enough. If you need the speed, you will know, but at least then you will have a simple prototype which will keep you from falling in any stupid traps on the way.

So to answer your question, development speed is the factor that makes people want to use these languages. You don't have to jump through hoops unless you need run-time execution speed.

And yes, Python has excellent library support for doing just about anything that doesn't have to be blazingly fast. This, along with better language constructs (more dynamic classes and methods, weak typing, versatile and easy-to-use lists and mappings, list mapping functions etc), is what makes development much faster. Oh, and it doesn't hurt that you can dynamically test the things you've written, if you want to.

2 comments

Thanks for your reply. One more question, I am maybe old fashionned, but weak typing kind of scared me. I am more used to strong typing and I find it weird when I look at python variable declaration. In my point of view, strong typing helps avoid bugs and write cleaner programs. What advantages do you see in weak typing?
Some arguments I have seen for dynamic typing:

- Code is shorter and potentially easier to read.

- While static typing can identify some bugs at compile time, these are usually the easiest bugs to find regardless of the language you use. The hard bugs -- the ones not caught by the compiler -- only become obvious through testing. So if you have a good suite of tests, you will find both classes of bugs, whether or not you use a statically typed language.

- In a dynamically typed language, you spend less time wrestling with the typing system -- instead of casting in C or Java, doing long template-related declarations in C++, or convincing ML or Haskell that your program should be allowed to run.

- And, more theoretically, a statically typed language limits the space of programs that you can write. While most of the programs disallowed by static typing are buggy, some are useful, and a statically typed program with the identical useful functionality is longer.

Of course, static typing has its benefits as well. It's the reason our fastest languages are as fast as they are, and it's a comforting safety net, especially in large projects.

You have it backwards, actually. Python is strongly typed and C++ is weakly typed. You probably meant dynamically/statically typed.