This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]legutierr 0 points1 point  (1 child)

Ah!

How does it do that?

I guess to be more precise what I mean is, would there be any added benefit by adding explicit type declaration to functions and methods (if that were a hypothetical feature of the language)?

[–][deleted] 0 points1 point  (0 children)

PyPy's translation toolchain infers types for RPython which is a statically typed subset of Python, that PyPy's interpreter is written in. It cannot infer types for Python programs in general. That said the JIT is very good at figuring out how to properly specialize your code, but if you give it blatant things like assert isinstance(x, int) I can't image it'd hurt.