Skip to content

overloading __getattr__() #2737

Answered by erictraut
lovetox asked this question in Q&A
Discussion options

You must be logged in to vote

When pyright evaluates __getattr__, it assumes that the name is of type str. It doesn't create a literal type for the member name. I think it's reasonable to support this. It's a relatively minor change.

I'll point out that this doesn't work in mypy, which complains that the signature for the __getattr__ overload is incorrect.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by lovetox
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants