IMHO there are important differences: A generic class is a "constructor" of a class given a complete class, to be instantiated at some later point; also, in Python the type parameter cannot be directly inspected; A metaclass is a "constructor" of a class given a set of definitions, to be instantiated immediately - inspection is allowed and usually necessary. - Elazar On Tue, 28 Jan 2020 at 01:05, Saul Shanabrook via Typing-sig < typing-sig@python.org> wrote:
Ah, I seem to have not added a name to my account, it should be fixed now.
I don't see how you would be able to do the same work-around though for `__init__`, to allow the `MyCustomClass[int]()` to be differentiated at runtime from `MyCustomClass[str]()`
Was it discussed somewhere why generic type are not implemented as metaclasses? It seems like if they were, then you would be able to do this, by simply taking `type(self)` to give you back the generic type. Also, from a conceptual perspective, if I squint my eyes, generic classes seem like they should be metaclasses, since they are basically functions that return classes, just with a different syntax than normal function calls for stylistic purposes. _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/