• + 1 comment

    late to the party, but here I added a print to the list class:

    class mylist(list):
        def print(self):
            print(self)
    
    n = int(input())
    l = mylist()
    
    for _ in range(n):
        cmd = input().strip().split()
        args = 'l.{}({})'.format(cmd[0], ','.join([v for v in cmd[1:]]))
        eval(args)