A class is the particular object type that is created by executing a
class statement.
Self is merely a conventional name for the first argument of a method
-- i.e. a function defined inside a class statement.
An unbound method is a method that is not yet bound to an instance.
You get an unbound method if you ask for a class attribute that happens
to be a function. You get a bound method if you ask for an instance
attribute. A bound method knows which instance it belongs to and
calling it supplies the instance automatic; an unbound method only
knows which class it wants for its first argument (a derived class is
also OK). Calling an unbound method doesn't "magically" derive the
first argument from the context -- you have to provide it explicitly.
> but calling i2.say() brings 'program terminate because error -xxx
> has occorred' (I am using a mac) and get me back to the OS.
Your Mac program died of stack overflow because of the problem I
explained in my previous message: the meaning of self.__class__
depends on the instance's class, not on the context in which it is
executed.
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
<URL:http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>