Python as an Object Oriented Programming Language

Michele Simionato mis6 at pitt.edu
Wed Dec 18 17:12:43 EST 2002


"Steve Holden" <sholden at holdenweb.com> wrote in message news:<QPLL9.2$_I4.1 at FE05>...
"Michele Simionato" <mis6 at pitt.edu> wrote in message
news:2259b0e2.0212171221.7763649e at posting.google.com...
>> I have a few general questions on Python as an Object Oriented Programming
>> language.
<snip>
>> Am I correct or still there are subtle difference between classes and types
>> even in new style classes ?

> What's the type of an instance of a classic class? What's the type of a type
> instance? That's the principal difference from the naiive user's PoV.

I don't see your point.

>>>class C: pass
>>>type(C())
<type 'instance'>

>>>type(type)
<type 'type'>

>>> class C(object): pass
>>> type(C())
<class '__main__.C'>

The difference between classic classes and new style classes will go away,
and the result for type does not surprise me, since type is the metaclass
which metaclass is itself. I was saying types and classes are unified in
the sense that

>>>type(type)==type.__class__
1

> > 2. What does it mean "pure" Object Oriented language ?
> >
> Puse in this context means that every type inheritds from some archetypical
> base type. Hence 2.2.2, even, is not "pure", while SmallTalk (where integer
> is a subclass of object) is.

???

>>> issubclass(int,object)
1

                       Michelee



More information about the Python-list mailing list