[Python-Dev] Adding types.build_class for 3.3

Tres Seaver tseaver at palladion.com
Wed May 9 00:37:24 CEST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/07/2012 09:59 PM, Nick Coghlan wrote:
> On Mon, May 7, 2012 at 11:42 PM, Hrvoje Niksic <hrvoje.niksic at avl.com>
> wrote:
>> On 05/07/2012 02:15 PM, Nick Coghlan wrote:
>>> 
>>> Benjamin's suggestion of a class method on type may be a good
>>> one, though. Then the invocation (using all arguments) would be:
>>> 
>>> mcl.build_class(name, bases, keywords, exec_body)
>>> 
>>> Works for me, so unless someone else can see a problem I've
>>> missed, we'll go with that.
>> 
>> 
>> Note that to call mcl.build_class, you have to find a metaclass that
>> works for bases, which is the job of build_class.  Putting it as a
>> function in the operator module seems like a better solution.
> 
> No, the "mcl" in the call is just the designated metaclass - the 
> *actual* metaclass of the resulting class definition may be something 
> different. That's why this is a separate method from mcl.__new__.

Why not make it a static method, if there is no notion of a useful 'cls'
argument?


Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+poCQACgkQ+gerLs4ltQ6IUwCfckUDbCCFjRPcFtvQmTXUcGuv
8RYAoKzry9l0xB7G+I0fIBqAp+3DJTdc
=3kdb
-----END PGP SIGNATURE-----



More information about the Python-Dev mailing list