Core characteristics of Python
Table of Content:
EXECUTION MODEL
Interpreted. Python is actually compiled to bytecode, which is then interpreted by the Python runtime. The Pypy implementation includes a just-in-time (JIT) compiler to generate machine code on the fly. Go is compiled directly to machine code.
INTERACTIVE CONSOLE
Bundled. Also, multiple enhanced consoles are available, including iPython, Jupyter Notebook, and Python Anywhere (online). An interactive console or REPL is an excellent learning, debugging, and exploration tool. iPython and its offspring, Jupyter Notebook, were keys to the success of Python in data science.
STANDARD LIBRARY
Comprehensive
INHERITANCE
Multiple inheritance
TYPING
Strong, dynamic. Both languages are strong typed (i.e., they avoid implicit type conversion, a source of many bugs in JavaScript). Python introduced type hints in v3.5 (2015) to support static checking and enhanced IDE support for autocompletion; the type annotations have no effect on runtime behavior, so the language remains dynamically typed.
INTERFACE ENFORCEMENT
At runtime, via duck typing (allows for the running of operations on objects without specifically having to predefine those objects beforehand).
FIRST CLASS FUNCTIONS
Yes. This means that a function can be assigned to a variable, passed to another function as an argument, and returned as a result from another function.
CLOSURES
Yes
ANONYMOUS FUNCTIONS
Limited syntax. Python’s lambda keyword allows anonymous function declarations that hold only expressions but not statements such as loops.
DATA ABSTRACTION
Classes, named tuples