Explorar el Código

support generics

blueloveTH hace 2 años
padre
commit
8ec3bb0b5d
Se han modificado 2 ficheros con 2 adiciones y 2 borrados
  1. 1 1
      python/builtins.py
  2. 1 1
      python/typing.py

+ 1 - 1
python/builtins.py

@@ -222,7 +222,7 @@ tuple.__ge__ = __f
 list.__ge__ = __f
 list.__ge__ = __f
 
 
 type.__repr__ = lambda self: "<class '" + self.__name__ + "'>"
 type.__repr__ = lambda self: "<class '" + self.__name__ + "'>"
-type.__getitem__ = lambda self, T: self     # for generics
+type.__getitem__ = lambda self, *args, **kwargs: self     # for generics
 
 
 def help(obj):
 def help(obj):
     if hasattr(obj, '__func__'):
     if hasattr(obj, '__func__'):

+ 1 - 1
python/typing.py

@@ -23,5 +23,5 @@ TypeVar = _PLACEHOLDER
 Self = _PLACEHOLDER
 Self = _PLACEHOLDER
 
 
 class Generic:
 class Generic:
-    def __getitem__(self, T):
+    def __getitem__(self, *args, **kwargs):
         return object
         return object