> It's easy for a compiler to check that a function you're calling requires 3 arguments of type foo, bar and baz
No, it's not. It's actually impossible to determine, since you can reassign any function at runtime. Essentially you can do:
self.some_func = one_implementation
...
self.some_func = another_implementation
Those two implementations don't have to have the same types, can accept any number of parameters, can be wrapped in something else, etc. etc. Compiler cannot figure it out ahead of time.On the other hand, it opens a lot of new possibilities that are not available in compile-time type checks. For example mocking objects in other modules:
def test_some_other_module(self):
tested_module.SpecificClass = Mock()
tested_module.SomeFactory.getBlah(1,2,3)
self.assertTrue(tested_module.SpecificClass.called_with([1,2,3]))
reload tested_module
Whether it introduces other bugs is a different discussion... Sure, it's worse than Haskell where things tend to work the first time they compile, but on the other hand I get more annoyance from Java-style types than they're worth in practice. YMMVhttp://www.google.co.uk/search?q=site%3Abugzilla.redhat.com+...
http://www.google.co.uk/search?q=site%3Abugzilla.redhat.com+...
http://www.google.co.uk/search?q=site%3Abugzilla.redhat.com+...
(There are many more searches of this type you can do).
Red hat engineers suck (I know this isn't true)
I'm a genius (this isn't true either)
Different types of software have different needs and we shouldn't generalize about all software development based on our particular niche. Writing code that runs on other peoples systems is much harder than writing code that will run on servers I control. Python and ruby are great for the latter. I've never done the former at the scale of redhat. Writing code with a lot of collaborators is harder than writing it with a few collaborators.
What language do you prefer for your type of work?
also - there are code parsers like pylint that help you sanity check your source code in that manner.
speed - python is slow. We use python in scientific computing in extremely CPU intensive problems because python makes it very easy to control C and C++ layers that do the underlying work. that power in an interactive environment, complete with good visualization tools is great for science
If I typo something in ruby, I will not know unless that code path gets executed through a test. This would never happen in a statically typed language.
However I think the productivity benefits of dynamic typing far outweighs this risk in my experience.
The argument that there are hundreds of bugs because of it does not mean anything - you make the wrong assumption that everyhing else is equal. Of course, if dynamic typing was only about not checking types, it would be dumb. But it also gives you flexibility and avoids a lot whole lot of other kind of bugs, so you are trading one kind of bugs with another kind. For me, complaining about dynamic typing is like saying that exception cause a lot of bugs compared to error codes, because your application crashes if you don't catch exception. It is true in some sense, but the argument is rather stupid.
As for memory consumption: running an application in 64 bits, even if programmed in C, often requires much more memory, at least statistically speaking and in my experience. For example, running a simple ubuntu desktop in 64 bits takes easily 50 % more memory than in 32 bits (and it is not because of python :) ). Int, floating points are indeed the same, but structures, pointers and alignement requirements almost inherently increase memory in a significant way.
The 64 bit issue is definitely not the "same for all languages". Programs get slightly bigger, but don't double in size as happens for Python programs. Most Linux 64 bit C programs will be using 32 bit 'int'. Python consumes 24 bytes to store any single int on 64 bit.
Code generators: I mean ones which anyone uses.
Lack of type safety: it may well be "by design", but it's a dumb design which causes lots of problems. Search Bugzilla for Python tracebacks and you'll see hundreds of bugs caused by lack of basic compile-time type checks. It's easy for a compiler to check that a function you're calling requires 3 arguments of type foo, bar and baz, and not doing that simply causes lots of errors.
The whitespace issue is also real: if/else changes its meaning completely if you're not hyper-careful about how you apply patches (especially when you have to make manual fixes to patches to get them to apply).