我想做这样的事情
import builtins
class HackedList(list):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __getitem__(self, item):
pass # my code here
builtins.list_literal = HackedList # there is no such thing as list_literal, only list which seems to have no effect on literal itself
我需要重写内置函数,而不是子类。