June 6, 2023
12:28 p.m.
Funnily enough I have also been working on something similar to this for a few months and I didn't even realise this was already a proposed thing but I guess I might show what I had in mind in light of PEP 695 being accepted. I agree that there's an unfortunate lack of exposed methods for getting type parameters at runtime. Full very not completed draft here https://gist.github.com/Gobot1234/f78229cd41beaeab87b24a93b5ba70ff. If Saul you'd want to work together on this or b.v.b that'd be cool. There is a PEP that needs to go through for subscripting functions at runtime separate to this (https://discuss.python.org/t/making-functions-subscriptable-at-runtime/26463).