[Python-Dev] Adding types.build_class for 3.3 (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Fri May 11 02:56:00 CEST 2012


On Fri, May 11, 2012 at 3:31 AM, Barry Warsaw <barry at python.org> wrote:

On May 09, 2012, at 07:44 PM, R. David Murray wrote:

(*) Actually, come to think of it, I probably refer to it as "constructing" the class, rather than creating or defining it. It's the type equivalent of constructing an instance, perhaps? If, as Nick proposes in a different message, it actually does make better sense to put this as a module-level function, then putting class in the name makes sense.  types.{new,create,build,construct}class() works for me, in roughly that order.

Yeah, as a result of the discussion in this thread, and considering the parallel with "imp.new_module()", I'm going to update the tracker issue to propose the addition of "types.new_class()" as the dynamic API for the PEP 3115 metaclass protocol.

The question now moves to the implementation strategy - whether we redirect to the C machinery as originally proposed (either via build_class or a new _types module) or just reimplement the algorithm in pure Python. The latter is actually quite an appealing concept, since it becomes a cross-check on the native C version.

Cheers, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-Dev mailing list