-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic property not supported #153
Comments
This is by design. Any static type checker needs to make certain assumptions to be effective. If pyright assumed that any property could be added dynamically to any class, its value would drop significantly because it wouldn't be able to report a wide variety of common bugs. If you want to dynamically add properties to your classes, you have a few choices:
If you want to get the most value out of static type checking, option #3 is my recommendation. |
For anyone else, here's the code that worked for me (I only read the attributes; presumably if you set them you also need
Might be nice to document this. (And yeah don't do this unless you are forced to work with people that don't get static types.) |
Dynamic property not supported
Problems:
Code is right!
The text was updated successfully, but these errors were encountered: