Introduction of the View Type for Static Typing
20 Sep
2023
20 Sep
'23
3:09 p.m.
Hello, I had an idea for a new type annotation called "View" type hint to indicate attributes that are readable both internally and externally but should only be writable internally. Example usage: from typing import View class MyClass: def __init__(self) -> None: self.my_attr: View[int] = 0 This is equivalent to below from a static type checker's point of view. class MyClass: def __init__(self) -> None: self._my_attr = 0 @property def my_attr(self) -> int: return self._my_attr
432
Age (days ago)
432
Last active (days ago)
0 comments
1 participants
participants (1)
-
juho.kim@mail.utoronto.ca