Difference between type and class



Hello,

Can someone explain to me the difference between a type and a class?
After reading http://www.cafepy.com/article/python_types_and_objects/
it seems to me that classes and types are actually the same thing:

- both are instances of a metaclass, and the same metaclass ('type')
can instantiate both classes and types.
- both can be instantiated and yield an "ordinary" object
- I can even inherit from a type and get a class

So why does Python distinguish between e.g. the type 'int' and the
class 'myclass'? Why can't I say that 'int' is a class and 'myclass'
is a type?

I hope I have managed to get across the point of my confusion...


Thanks in advance,

-Nikolaus

--
»It is not worth an intelligent man's time to be in the majority.
By definition, there are already enough people to do that.«
-J.H. Hardy

PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C
.



Relevant Pages

  • Re: This I simply cant swallow
    ... encapsulation and abstract data types are completely orthogonal ... int i; ... MyClass i; //An instance of MyClass ... An ADT is a type that cannot, itself, be instantiated. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Why this fix work ?
    ... "int" is 32 bits wide. ... This is basically a matter of luck -- bad luck that it works at ... MyClass* myobj; ... "MyClass *", which is actually 64 bits wide. ...
    (comp.lang.c)
  • Re: Class Destroys itself straight away!
    ... CRectangle; ... int area ... MyClass mc = MyClass; ... void MyClass::SayHello ...
    (microsoft.public.vc.language)
  • Re: Explicit function vs. overloaded operator?
    ... > void operator() (int x, ... The conceptual advantage is that if class MyClass does just one thing, ... make the code easier to read. ...
    (comp.lang.cpp)
  • Re: Re-executing the code object from a class declaration
    ... the same code object as that where the 'class MyClass' is, ... -- because basically you ARE re-executing the whole kaboodle. ... environment a code object is a tiny little thing. ... > metaclass, but I couldn't make it work. ...
    (comp.lang.python)