Chapter 7. Python Extensions in Other Languages
When writing Python-based applications, you are not limited to the Python language alone. There are tools such as Hy, mentioned briefly in Chapter 3, Syntax Best Practices – above the Class Level. It allows you to write modules, packages, or even whole applications with some other language (dialect of Lisp) that will run in Python virtual machine. Although it gives you the ability to express program logic with completely different syntax, it is still quite the same language because it compiles to the same bytecode. It means that it has the same limitations as ordinary Python code:
- Threading usability is greatly reduced due to the existence of GIL
- It is not compiled
- It does not provide static typing and possible optimizations that come with it
The solution that helps in overcoming such core limitations are extensions that are entirely written in a different language and expose their interface through Python extension APIs.
This...