| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, good hack!
Sorry, something went wrong.
|
This is the best thing to do if we want to have strict typing in clinic.py, but I wonder if we do? The original motivation for adding type hints was to improve maintainability and readability, and this change possibly works against that. The original justification for running a type checker in CI was to have a means of verifying the accuracy of the annotations we were adding, not necessarily because we wanted the code to be strictly type-checked. Thoughts @erlend-aasland? I don't want to be introducing "typing hacks" into clinic.py if you disagree with the principle :) |
Sorry, something went wrong.
|
Strict type-checking is not a goal at the moment. I agree that this does not contribute to increased readability, so I say we drop it. |
Sorry, something went wrong.
Sounds good. Thanks! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
When type checkers see that a class has a __getattr__ or __getattribute__ method, they'll assume that there are things going on with that class that are too magical for them to understand. As such, they will refrain from emitting any errors relating to setting or retrieving attributes from instances of that class. That's basically the opposite of what we want here (there'll be a runtime exception from any attribute access on an instance of LandMine). As such, it's much better to pretend to the type checkers that the __getattribute__ method doesn't exist.