3 ms·
There's no requirement that type annotations be accurate. With hidden classes and such it likely wouldn't matter much. You'd need them anyway for full dynamism
by nimish 5y ago
There's no requirement that type annotations be accurate.
With hidden classes and such it likely wouldn't matter much. You'd need them anyway for full dynamism
- _carljm 5y agoWith Static Python we use type annotations in compilation, and we require them to be correct (they are runtime checked at boundaries with non-Static code and throw TypeError if wrong types are passed in.) We haven’t gone the hidden classes route so far because it’s simpler to just look at attributes assigned in __init__ and annotated on the class and lock those into slots. If you’re writing typed Python you probably don’t do a lot of tacking extra ad hoc attributes onto instances, since type checkers don’t like that either.