
On 22 May 2019, at 11:35, Bernat Gabor gaborjbernat@gmail.com wrote:
I like to where this is going. Plus one from me. I assume the main users of this annotated metadata will be typing checker(s) plugins? (…)
Not necessarily. Mentioned in the PEP is a possible struct module runtime integration. I co-maintain Injector[1], a dependency injection framework, and It could also use the extra metadata at runtime. Currently one declares a constructor mixing injectable and non-injectable parameters like this:
@inject @noninjectable(‘value’) def __init__(self, service: Service, value: Value):
This PEP would make the following possible while reducing repetition somewhat and improving editor integration:
@inject def __init__(self, service: Service, value: Assisted[Value]):
Or even (remains to be seen which is better, maybe both could coexist):
def __init__(self, service: Inject[Service], value: Value):
(Assisted and Inject are hypothetical generic aliases).
Best, Jakub