Python is just a language, what makes it so ubiquitous is that it is very adaptable. In fact, all the packages I listed above are interfaces to libraries developed separately, and sometimes (often) in another language. This is what gives Python a much more than acceptable execution speed.
For example, Tensorflow and Torch are libraries developed in C/C++, occasionally a bit of Rust. Python is just there to hook into methods, to give you access to “low-level” layers with simplicity. In this case, if you create an AI model in Python, you are actually using layers in C, which will take care of compiling the model with CUDA.
In other words, Python is to packages what a push button is to the washing machine. It serves as an interface. But not only that… Because the language itself is not left out!
It is a reflective language
Python is of course a language first and foremost. Unlike many other languages, it is based on indentation (and therefore, it forces you to code a little more cleanly), and its semantics is oriented towards human language.
Let's take an example, you want to know if “John” is in the “ users ” list:
if"John"in users:
print("Oui j'ai trouvé John")
And it works the same way for a word in a sentence, or a key in a dictionary (an indexed table, roughly)
But what is very often cited in the advantages of Python is the “list comprehension”. In other words, its ability to understand and process a list in one line. Here are some examples:
users = ["Alice", "Bob", "John", "Bernard", "Bruce"]
# on ne veut que les prénoms commençant par B
Busers = [user for user in users if user[0]=="B"]
# filter out null entries
results = [ 1 , 4 , None , 5 ,9 , 4 , 10 , None , 6 ]
not_none = [r for r in results if r is not None ]
# all even numbers between 0 and 9
pairs = [p*2 for p in range(10)]
And that's nothing compared to the concepts of decorations, proxies, meta classes...
Flask for example makes heavy use of many Python concepts, look at this piece of code: Believe spain telegram data it or not, these few lines are enough to respond to an HTTP call on /api/v1/hello, no need to code more than that.
from flask import Flask
app = Flask(__name__)
@app.route("/api/v1/hello")
def hello():
return "Hello you!"
But then, why don't we use it more than that in ESN?
| We come to the initial question, posed in the preamble to this article.