Guido van Rossum
๐ค SpeakerAppearances Over Time
Podcast Appearances
We occasionally look at papers about HHVM, which is Facebook's efficient compiler for PHP.
There are tricks known from the JVM and PHP
Sometimes it just comes from academia.
This is a trick that is especially important for interpreted languages with dynamic typing, because if the compiler could read in the source
These X and Y that we're adding are integers.
The compiler can just insert the single add machine code, that hardware machine instruction that exists on every CPU, and ditto for floats.
But because in Python, you don't generally declare the types of your variables.
You don't even declare the existence of your variables.
They just spring into existence when you first assign them, which...
is really cool and sort of helps those beginners because there is less bookkeeping they have to learn how to do before they can start playing around with code.
But it makes the interpretation of the code less efficient.
And so we're sort of trying to make the interpretation more efficient without losing the super dynamic nature of the language.
That's always the challenge.
So the type hints is an optional mechanism that people can use.
And it's especially popular with sort of larger companies that have very large code bases written in Python.
It's more than documentation.
I mean, so it...
It is a sub-language of Python where you can express the types of variables.
So here's a variable and it's an integer.
And here's an argument to this function and it's a string.