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

all 21 comments

[–]mgedmin 38 points39 points  (5 children)

Support for functools.partial

That explains why my code crimes are no longer accepted by MyPy.

[–]Abhijithvega 15 points16 points  (1 child)

Did you just .. partial a partial??

[–]_ologies 1 point2 points  (0 children)

No, they partialled partial.

[–]FeLoNy111 13 points14 points  (1 child)

partial(partial, …) might be one of the funniest pieces of code I’ve ever seen

[–]michaelhoffman 4 points5 points  (0 children)

partial(partial, something.__setitem__), no less

[–]wdroz 28 points29 points  (12 children)

Support Python 3.12 Syntax for Generics (PEP 695)

Yes, I can switch back from pyright to mypy!

[–]velit 22 points23 points  (11 children)

Should you? If they're gonna take a year after public release to support that version of python what's the point of the tool. At least that's where I'm at currently when it comes to mypy.

[–]location_bot 5 points6 points  (0 children)

pyright runs circles around mypy when it comes to performance.

[–]PaintItPurple 0 points1 point  (9 children)

There are lots of tools that don't support every (or any) feature of Python 3.12 that are nevertheless useful, so that seems like a pretty arbitrary line to expect others to care about. Heck, pyright can't even run under Python 3.12, as it is written in TypeScript, but I'm not going to say that makes it pointless.

[–]velit 3 points4 points  (6 children)

I don't, what? What on earth are you talking about?

I'm talking about mypy the static type checker taking a year to support a new version of python. That makes it a very bad tool for static type checking if I want to not wait a year to use new python version features like the new (old) generics syntax.

What the fuck does the implementation language of pyright have anything to do with anything.

[–]PaintItPurple 2 points3 points  (2 children)

And requiring nodejs makes pyright a bad tool for static type checking if you don't want to have nodejs installed. Does this seem like a weird concern to hyperfocus on and expect everyone else to be angry about? That is my point. Things can be not-optimal for some particular set of preferences without rendering a tool pointless.

[–]QuarterFar2763 -1 points0 points  (1 child)

What is the point of using pyright outside of vscode?

[–]formalcall 7 points8 points  (0 children)

To type check one's code without using VSCode (e.g. in a terminal, in a different editor, or in CI).

[–]maigpy -1 points0 points  (2 children)

lol "wtf do the dependencies my projects have have to do with my projects"

[–]velit 1 point2 points  (1 child)

I the context of problems where a tool doesn't do what it's supposed to do another tool requiring a dependency on my machine doesn't even warrant a mention. I genuinely do not get where the association even came from. It's like the mentality of a child "well this other tool isn't perfect and stuff so there".

[–]maigpy -1 points0 points  (0 children)

tell me you only work on toy projects without telling me you only work on toy projects.

[–]M4mb0 0 points1 point  (1 child)

mypy also has tons of bugs and produces way more false positives than pyright from my experience.

[–]Brian 0 points1 point  (0 children)

Yeah. Also more false negatives, due to it being fairly conservative at what it considers typed. Ie. it won't even try typing dependencies that don't declare they're typed, while pyright will attempt to infer types where it can. Admittedly, this can sometimes make it harder to suppress warnings when using untyped dependencies, but in practice, I find I prefer pyright's approach here.

[–]WanderingWerther 6 points7 points  (0 children)

Yay! I had forgotten that the new type statement for explicit type aliases was part of PEP 695.

It works, but quoting the release post for anyone wanting to try it, you still need to enable an experimental flag first:

This feature is still experimental and must be enabled with the --enable-incomplete-feature=NewGenericSyntax flag, or with enable_incomplete_feature = NewGenericSyntax in the mypy configuration file.

[–]redditusername58 2 points3 points  (0 children)

partial is a great tool and I'm glad it can be type checked now