Let's say I have a module CustomClasses.py, which contains 10 classes. I have a method let's say process()
which can take an object of any of the classes of the CustomClasses
module.
Method:
def process(custom_class_instance):
some code...
Now, for type hints for custom_class_instance
, I can use typing.Union
to indicate supported types, but that would definitely take much of the code space (hence reduce readability) and would be some manual work. So is there some other way, with which I can specify that the custom_class_instance
would be an object of any of the classes in CustomClasses.py.