3 ms·
>It feels like Von Rossum is making life hard for the PyPy compiler project again. Or perhaps, he realizes that to require these typechecks at runtime would ei
by zardeh 10y ago
>It feels like Von Rossum is making life hard for the PyPy compiler project again.
Or perhaps, he realizes that to require these typechecks at runtime would either
- require a massive rewrite of the CPython interpreter
- cause a performance penalty in code that is statically typed (there are pure python libraries that allow this, and yes your code runs slower)
Further, it offers a relatively narrow amount of help to pypy, which has already come out and said that they have no interest in using annotations for efficiency gains, because they're a jit and they don't need them.
- Animats 10y agoPyPy is written in RPython, which is Python with type annotations strict enough to allow hard precompilation to C. The type syntax is completely different from this new thing.[1] Only the built-in types are fully defined. There's "anytype", "sequence", and "object" to cover more general types without giving full details. This allows hard compilation of the stuff that compiles down to machine code, while dealing with user-defined object types more dynamically. That's one approach to typing Python. Von Rossum on PyPy (2016): "Otherwise, there are specialized versions of Python like PyPy that are still around." [1] https://bitbucket.org/pypy/pypy/src/default/rpython/translator/test/snippet.py?fileviewer=file-view-default https://bitbucket.org/pypy/pypy/src/default/rpython/translat...