Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Mypy 1.5 Released (mypy-lang.blogspot.com)
24 points by genericlemon24 on Aug 10, 2023 | hide | past | favorite | 10 comments


I've read a lot of good things about Google's `pytype`, which supposedly does a better job inferring types of unannotated code than `mypy`. Has anyone used `pytype` seriously, and does it compare? Is there a reason to prefer `mypy` at all, other than the fact that it's (mostly) first-party?


So, I tried out pytype the other day, and it was a not a good experience. It doesn't support PEP 420 (implicit namespace packages), which means you have to litter __init__.py files everywhere, or it will create filename collisions. See https://github.com/google/pytype/issues/198 for more information. I've since started testing out pyre.


TIL PEP 420 exists! I'm not entirely sure if I like it... Now there's two ways of doing the same thing and one is not really explicit....


pytypes readme specifically says it doesn't support 3.11. so it's a non-starter for me.


Lack of Windows support is also big no-no.


pytype dev here - we're actively working on 3.11 support at the moment, targeting somewhere in Q4.


Out of curiousity, serious questions.

Is this support for specific features, or does it just not work in 3.11?

What's the issue? High level anyways, I'm sure there's stuff that seems basic, but is incredibly complex under the proverbial covers.


pytype works by symbolic execution of compiled python bytecode, and the bytecode changed a fair bit between 3.10 and 3.11. we essentially have to implement some of the new features of the cpython interpreter first to simply execute 3.11 code, after which we need to handle new typing features. (we have to do this for every new version, but usually the bytecode doesn't change as much, it's typically new python features like pattern matching, and new typing features like variadic generics, that take time to implement in pytype)


Thanks for the response. That sounds like a pretty monumental task


Tangential, but is there a way to annotate an expression as non-nullable? In TS we have `expression!`, but in Python we have to `assert var is not None` after `var = fn_that_returns_str_or_none`.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: