If the implementation lands in typing_extensions *now*, maybe it's reasonable to review that and copy it into the stdlib as soon as the PEP has been accepted. We could make that work. Don't wait implementing until the PEP is accepted though! On Wed, May 22, 2019 at 5:03 AM Jakub Stasiak <jakub@stasiak.at> wrote:
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
[1] https://github.com/alecthomas/injector
_______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/his **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>