Yossarrian22 a day ago

Close, Microsoft’s type checker Pyright is Typescript. Its still faster than mypy for me though.

  • chrisweekly a day ago

    Pls forgive my ignorance, but how is Typescript (a superset of Javascript) used to type-check Python?

    • thraxil a day ago

      You can write a parser and type checker for pretty much any language in pretty much any language. It's just text files as input and text as output.

    • ItsHarper a day ago

      They're saying pyright is a Python type checker, but it's written in Typescript, not Rust.

    • Yoric a day ago

      There's nothing magical to type-checking Python. You can write this in any programming language. TypeScript is actually a pretty nice language for writing static analysis tools.

    • [removed] a day ago
      [deleted]
    • dist-epoch a day ago

      just like the Python compiler/interpreter is written in C.

[removed] a day ago
[deleted]
[removed] a day ago
[deleted]
morkalork a day ago

They're all static type checkers right? None for runtime?

  • Yossarrian22 a day ago

    Yes. If you want runtime validation of data you’re taking in people recommended pydantic. If you’re looking for runtime validation within your own code I’ve seen people use beartype, though to be honest I don’t personally understand the value added from it

    • rationably a day ago

      ...or Marshmallow, which allows one to do many complex validations in a relatively trivial manner.

      • morkalork a day ago

        On one hand, I feel like I've been in a coma since covid because I've just been coasting along with Marshmallow and jsonschema, but on the other hand it's like a lot of the major advances have been in the past couple years. Apparently pydantic got a big version update in 2023? And now all these competing static type checkers?