-
-
Couldn't load subscription status.
- Fork 1k
Closed
Labels
Description
The class Message defines the attribute sender as being of the type MessageTarget, which is a fairly generic protocol. Fine.
When writing custom messages, wouldn't it make sense to add an explicit type hint to mark the class variable sender as being of the type of the widget within which the message is being defined?
E.g., won't this make sense:
class MyWidget(Widget):
class MyMessage(Message):
sender: MyWidget # Isn't this something sensible to do?
def __init__(self, sender: MyWidget, ...):
...By adding sender: MyWidget in the body of the class, IDEs and static checkers will let me make use of .sender as of being the type I already know it is.
davep