Hi, But why does it show varied difference in the time between a and b instance creations when __metaclass__ hook is used and when not used in class Y ? I dont understand that point !
KM On 9/1/07, Michele Simionato <[EMAIL PROTECTED]> wrote: > > On Sep 1, 6:07 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > <snip> > > > > Debugging with Wing IDE and examining the classes at a breakpoint shows > > this to be true (even after Y's __metaclass__ assignment is commented > out): > > > > >>> X.__metaclass__ > > <class '__main__.Meta'> > > >>> Y.__metaclass__ > > <class '__main__.Meta'> > > >>> > > For the benefit of the readers I will just point out that in order > to determine the metaclass of a class it is far better NOT to relay on > the > __metaclass__ attribute. The right thing to to is to look at the > __class__ > attribute, or to use type. Here is a (made up) example > where .__metaclass__ gives > the wrong result: > > > In [9]: class M(type): pass > ...: > > In [10]: class B: __metaclass__ = M > ....: > > In [11]: B.__metaclass__ = None # now the hook is set to None, but the > metaclass does not change > > In [12]: B.__class__ > Out[12]: <class '__main__.M'> > > Michele Simionato > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list