On Fri, Aug 14, 2020, 7:53 PM Caleb Donovick <donov...@cs.stanford.edu> wrote:
> > I don't see what that can possible get you that `Struct(x=int, y=str)` > doesn't. > > Using `Struct(x=int, y=str)` requires a metaclass, where `Struct[x=int, > y=str]` does not. > Why would it require a metaclass? Rather than just: class Struct: def __init__(self, **kws): ... Yes, that won't get you the MRO for T, but neither can __getitem__() on an entirely different object Struct. A class factory is also an option, of course.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/I3W5LWDAZAUIZ4JBCLK6I3JROWFFCJ7C/ Code of Conduct: http://python.org/psf/codeofconduct/