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__()}"

comments