Dynamically Typed

In almost all cases (except for programming languages like Julia, Lisp, etc.), a language that is compiled makes sure that all the syntactical rules are followed and checked at compile time. An interpreted language is more relaxed concerning the rules and doesn’t enforce all of them until you actually run the program.

So let’s throw a wrench into the discussion. Although Python is an interpreted language, you need to understand what that really means. As you execute the Python application, the interpreter takes each expression or programming statement and converts it to a type of machine code so it can be executed.

Python is a dynamically typed language, meaning that any values that you have decided to store and use again (called variables) are rule-checked during runtime. In other words, as the program is running, if you try to save any data in memory so you can use that value later on in the program the data can be of any value.

In a strongly typed language, which is also called a statically typed language and is the opposite of a dynamically typed language, the developer must specify the type of data that will be stored. A programming statement can indicate to the computer that it needs to store a number in a specific location, and for the rest of that application’s execution, the computer will expect a number. If the program ever attempts to store a non-number to that location, an error will be created, and the program will die a horrible death.

In contrast, a dynamically typed language is a peace, love, whatever, type of programming environment. If at first, the program stores a number to a location and then later stores a non-number to that location, the Python runtime environment says, “Whatever! You must know what you are doing.” That makes programming very flexible, but it comes at a cost. A strongly typed language knows what type of data value to expect (i.e., number, character, true, false, etc.), so the execution of that type of programming statement is optimized for speed. A dynamically typed language has to check the value as the program is running, so it knows how to handle the specified data type.

What is the right answer? It all depends on the language that you choose to write your programs and what your needs are.