Dennis Sweeney <sweeney.dennis...@gmail.com> added the comment:

typing.cast doesn't actually do anything, it only exists as a hint for 
type-checkers.

As William noted, using the 3-argument type(...) as you showed will only return 
a type, not a mcs.

I think you may want super().__new__(mcs, name, bases, namespace), which will 
return an instance of mcs. You could also write type.__new__(mcs, name, bases, 
namespace), but that would make multiple inheritance harder should you ever 
want to do that. 

Another note: x(*args) translates to type(x).__call__(x, *args), so whether or 
not I am callable depends not on whether I have a __call__ attribute, but 
rather on whether my type has a __call__ attribute

See also: https://stackoverflow.com/q/6760685/11461120

----------
nosy: +Dennis Sweeney

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43685>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to