Python is a high-level general-purpose programming language that is used, among other things, to develop web applications. The language is focused on improving developer productivity and code readability.
Python supports several programming paradigms: structural, object-oriented, functional, imperative, and aspect-oriented. The language features dynamic typing, automatic memory management, full introspection, an exception handling mechanism, multi-threading support, and convenient high-level data structures. Python code is organized into functions and classes that can be combined into modules, which in turn can be combined into packages. Python is normally used as interpreted, but can be compiled to Java bytecode and MSIL (as part of the .NET platform).
Python developers adhere to a particular programming philosophy called “The Zen of Python”:
- Beautiful is better than ugly.
- Explicit is better than implicit.
- Simple is better than complicated.
- Complicated is better than confused.
- Flat is better than nested.
- Sparse is better than dense.
- Readability matters.
- Special cases are not so special as to break the rules.
- That said, practicality is more important than flawlessness.
- Mistakes should never be glossed over.
- If not glossed over explicitly.
- When encountering ambiguity, reject the temptation to guess.
- There must be one-and preferably only one-obvious way to do it.
- Although it may not be obvious at first, unless you are Dutch.
- Now is better than never.
- Although never is often better than right now.
- If the implementation is hard to explain, the idea is bad.
- If the implementation is easy to explain – the idea is probably good.
- Namespaces are a great thing! Let’s make more of them!
- In terms of performance, interpreted Python is similar to all other such languages, but the ability to compile to bytecode allows for better performance.
Compared to Ruby and some other languages, Python lacks the ability to modify built-in classes such as int, str, float, list and others.
Python has Global Interpreter Locking (GIL) – the main interpreter constantly uses a lot of thread-unsafe data when it runs. This is mainly dictionaries that store object attributes and calls to external code, so the interpreter thread captures GIL before execution of several instructions (usually a hundred) and releases it when finished, to avoid destroying this data if it is modified together from different threads.
There are several language implementations – CPython (basic), Jython, PyS60, IronPython, Stackless, Python for .NET, PyPy, python-safethread, Unladen Swallow, tinypy.
Python development.
Python is a very versatile language.
It’s good for web development but it’s not usually the best choice from an application point of view.
Ruby is usually more cost effective and efficient in web development (with similar quality results).
Compiled languages (Go / Elixir / Java) are much more efficient in terms of performance.
PHP development will be noticeably cheaper.
But in the fields of data analysis and machine learning Python is definitely out of competition now.