From 2b031e61a2a07eabe3b02b9e3b38c9bf45896922 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sun, 17 Sep 2023 21:17:02 +0800 Subject: [PATCH] ... --- python/builtins.py | 1 + python/typing.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/python/builtins.py b/python/builtins.py index 8b6132fe..75e420a4 100644 --- a/python/builtins.py +++ b/python/builtins.py @@ -222,6 +222,7 @@ tuple.__ge__ = __f list.__ge__ = __f type.__repr__ = lambda self: "" +type.__getitem__ = lambda self, T: self # for generics def help(obj): if hasattr(obj, '__func__'): diff --git a/python/typing.py b/python/typing.py index f553b032..bfc77b6e 100644 --- a/python/typing.py +++ b/python/typing.py @@ -20,4 +20,8 @@ Callable = _PLACEHOLDER Type = _PLACEHOLDER TypeVar = _PLACEHOLDER -Self = _PLACEHOLDER \ No newline at end of file +Self = _PLACEHOLDER + +class Generic: + def __getitem__(self, T): + return object \ No newline at end of file