0

I'd like to do something like this

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

I need to override builtin, not to subclass.

Helvdan
  • 416
  • 4
  • 14

0 Answers0