|
|
|
|
|
by yen223
858 days ago
|
|
I agree. Type-checking in general is good. However, Python's type-checking mechanisms are bad. The syntax for adding types is very obviously bolted on, they miss basic type errors all the time, and third-party libraries often miss type annotations anyway. Python is fundamentally a duck-typed language, and that's how you should use it. If type-checking is important to you, use a language that is designed for it. |
|
If there is anything complicated, you can either make a quick generic type (TypeVar) or even just throw in an Any type! I had to do that recently with a function that handled different ROS services, which apparently do not share any base class.