Closed
Description
There is an idea to allow modules be accepted where a protocol is expected. This pattern is sometimes used for configs and option management, for example:
# file default_config.py
timeout = 100
one_flag = True
other_flag = False
# file __main__.py
import default_config
from typing import Protocol
class Options(Protocol):
timeout: int
one_flag: bool
other_flag: bool
def setup(options: Options) -> None:
...
setup(default_config) # OK
This will allow better typing than just types.ModuleType
and should be straightforward to implement. Are there any objections against this?