Posts

Showing posts from May, 2014

Statically checking python

With python, type checking is usually done at runtime.  Python will tell you of type problems when you run the code.  At runtime Python will tell you if there is a problem with the program 1 + 'a' . Since the types int and string can not be added together with the + operator.  This is why Python is often considered only a dynamically typed language , not a statically typed language . However there are now tools to type check your python programs before you run them. Unfortunately it is not a widely known that you can type check python programs before you run them! But what exactly are the benefits of static type checking anyway?  If you have 100% unit test coverage of your code, shouldn't that catch all the same bugs? Yes, it probably would. However, not all teams unit test all of their code.  Also, sometimes it might be dangerous to run the code to check for errors, or maybe the code takes a long time to run before it encounters errors. You can check that: inte