I am trying to define a new type hint, however, it will not let me do this in Python 3.6 and I was wondering if there is any way around it. Here is my example code where I want my own class which takes a list as a field:
class T(type):
def __new__(cls, nums):
return super().__new__(cls, f'T((nums))', (T,),{})
def __init__(self, nums):
self.__origin__ = T
self.__args__ = nums
whenever I try to actually use this, I get
'type' object is not subscriptable
If I define a custom type hint that does not involve a list, the code works. Is there anyway I can define a custom type hint in python3.6?