Ben Finney wrote:
Eric Smith <[EMAIL PROTECTED]> writes:
Ben Finney wrote:
"Benjamin Peterson" <[EMAIL PROTECTED]> writes:
Line 94-95 in unittest.py (trunk):
# All classes defined herein are 'new-style' classes, allowing use of 'super()'
__metaclass__ = type
Hmm, you're right; I see that in Python 2.5.2 'unittest.py'.
Why is it not there in 3.0's 'unittest.py'? Is this achieved some
other way?
In 3.0 there are only new-style classes, so nothing needs to be done
there.
What makes that happen in the case where a class declares no
superclass? Is there an invisible enforced "__metaclass__ = type" for
every module? Where can I read about this change?
The magic is actually in 2.x, not in 3.0. In 2.x, if you don't explicit
set the metaclass (or inherit explicitly from an object which sets it),
then the default metaclass is 'classobj'. In 3.0, that magic goes away
and the default metaclass is just 'type'.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
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