class(object) and (type)??
Bruno Desthuilliers
bruno.42.desthuilliers at websiteburo.invalid
Tue Sep 9 04:47:14 EDT 2008
On Mon, Sep 8, 2008 at 2:35 PM, AON LAZIO <aonlazio at gmail.com> wrote:
> Hi again pythoners,
> I notice in the class of a code having (object) and (type) attached to
> the name of the class.
> I know that in other cases, that means the class inherits methods and
> properties from other but
> In this case, what does it mean?
The very same thing. Why should it have a different meaning ?
For the record :
- 'object' is the base class for 'new-style' classes - that is, the
'new' (hem) object model that came with Python 2.2 (released december
2001 - so it's not that 'new'). The old one - known as 'classic classes'
has been kept so far for backward compat only, and will finally
disappear with Python 3.x.
- 'type' is the base metaclass. Python's classes being objects, they
have to be instances of a class - known as the metaclass. To avoid
metametaclasses, metametametaclasses etc ad infinitum, 'type' is an
instance of itself. And FWIW, a subclass of 'object', which is itself an
instance of 'type' (usually, brains start melting here...)
You'll find more informations (and hopefully clearer explanations) here:
http://www.python.org/doc/newstyle/
and of course in the FineManual(tm):
http://docs.python.org/ref/datamodel.html
HTH
More information about the Python-list
mailing list