← go back
so… how far can you nest your code?
class List(list):
name = ""
def __class_getitem__(cls, key):
class List_:
def __new__(_cls, *args, **kwargs):
new = cls.__new__(cls, *args, **kwargs)
new.name = key
return new
return List_
def __repr__(self):
return f"{self.name} {super().__repr__()}"
Jan 30, 2023, 12:55 PM
2 0 0
Comments