Issue 13135: Using type() as a constructor doesn't support new class keyword arguments (original) (raw)

Issue13135

Created on 2011-10-08 21:53 by gulopine, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg145190 - (view) Author: Marty Alchin (gulopine) Date: 2011-10-08 21:53
PEP 3115 introduced keyword arguments to class definitions and changed metaclasses to use them instead. Unfortunately, `type()` doesn't seem to have been updated to accept those keyword arguments as well. What this amounts to is that using `type()` as a constructor can no longer fully replicate the behavior of a class definition. Therefore, classes that use keyword arguments can't be created dynamically. I would attempt a patch, but I don't have a development environment capable of compiling Python, so I wouldn't have any chance to test it.
msg145197 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-10-08 23:37
That's not true. You simply call the metaclass itself.
msg145198 - (view) Author: Marty Alchin (gulopine) Date: 2011-10-08 23:57
Hrm, that does seem to satisfy the case I was immediately concerned with, but I was thinking there was another issue with it, but now I'm having trouble pinning down an example. I'll just assume I was getting ahead of myself. Thanks for the sanity lesson.
History
Date User Action Args
2022-04-11 14:57:22 admin set github: 57344
2011-10-08 23:57:27 gulopine set messages: +
2011-10-08 23:37:01 benjamin.peterson set status: open -> closednosy: + benjamin.petersonmessages: + resolution: not a bug
2011-10-08 21:53:38 gulopine create