On 05/06/14 22:27, Alain Ketterlin wrote:
> I have seen dozens of projects where Python was dismissed because of the
> lack of static typing, and the lack of static analysis tools.
If you are worried your code will bring down the next Ariane launch, I
can understand this argument. If you are only worried a junior developer
will make stupid mistankes that the test suite will trap, then no...
In Python you cannot spoof an object's type, which means the type safety
is strong. You cannot make Python silently return bytes of garbage by
using objects of incompatible types. You cannot add a char to a float,
and you cannot make a bit be treated bitwise as a float. You cannot make
Python silently treat four bytes as an int. The worst thing that can
happen is a TypeError raised at run-time. Yes, an unhandled TypeError
exception could in theory bring down Ariane. But you are probably not
developing for it.
When is static analysis actually needed and for what purpose? The
problem seems to be that managers, team leaders, CEOs, or (insert your
favorite tite), are not qualified to answer this question. So to be on
the safe side they go for as much static analysis as possible. But still
they avoid Ada, because, you know, the journals they read are full of