Nick Coghlan wrote:
On Wed, May 9, 2012 at 4:37 PM, Daniel Urban <urban.dani...@gmail.com> wrote:
On Wed, May 9, 2012 at 3:10 AM, Nick Coghlan <ncogh...@gmail.com> wrote:
We need the explicitly declared metaclass as well as the bases in
order to determine the correct metaclass.
Note, that the current patch (at http://bugs.python.org/issue14588)
obtains the explicitly declared metaclass from the keywords dict
(exactly like the class statement).
Ah, good point. In that case, consider me convinced: static method it
is. It can join mro() as the second non-underscore method defined on
type().
Be careful adding methods to type. Because type is its own metaclass
descriptors can appear to add strangely:
int.mro()
[<class 'int'>, <class 'object'>]
type.mro()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: descriptor 'mro' of 'type' object needs an argument
As a consequence of this, making build_class either a class method or a
static method will cause a direct call to type.build_class() to fail as
neither class method nor static method are callable.
Cheers,
Mark.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com