[Cooperative methods and super](http://www.python.org/download/releases/2.2/descrintro/#cooperation)

**This is an example pure python implementation of built in `super` by Guido for illustration purposes. I need some clarification on implementation of class `Super` below** 

In the code below invocation `someobj.__mro__` won't work. See my comment against the line.
With built in `super` simply an error is thrown.

`TypeError: super(type, obj): obj must be an instance or subtype of type`

Question:

My question is what was the intent of having that line in the first place?

So if the passed in object is not an instance of the passed in class then start using the object's mro...why??

```
class Super(object):
        def __init__(self, type, obj=None):
            self.__type__ = type
            self.__obj__ = obj
        def __get__(self, obj, type=None):
            if self.__obj__ is None and obj is not None:
                return Super(self.__type__, obj)
            else:
                return self
        def __getattr__(self, attr):
            if isinstance(self.__obj__, self.__type__):
                starttype = self.__obj__.__class__
            else:
                starttype = self.__obj__   ## This line does not work
            mro = iter(starttype.__mro__)
            for cls in mro:
                if cls is self.__type__:
                    break
            # Note: mro is an iterator, so the second loop
            # picks up where the first one left off!
            for cls in mro:
                if attr in cls.__dict__:
                    x = cls.__dict__[attr]
                    if hasattr(x, "__get__"):
                        x = x.__get__(self.__obj__)
                    return x
            raise AttributeError, attr

class A(object):
        def m(self):
            '''  m in A'''
            return "A"

class B(A):
        def m(self):
            '''  m in B'''
            return "B" + Super(B, self).m()

class C(A):
        def m(self):
            ''' m in C '''
            return "C" + Super(C, self).m()

class D(C):
        def m(self):
            ''' m in D'''
            return "D" + Super(B, self).m()

print D().m() # "DCBA"

```

Stacktrace:

```
Traceback (most recent call last):
  File "./supertest.py", line 73, in <module>
    print D().m() # "DCBA"
  File "./supertest.py", line 71, in m
    return "D" + Super(B, self).m()
  File "./supertest.py", line 33, in __getattr__
    mro = iter(starttype.__mro__)
AttributeError: 'D' object has no attribute '__mro__'

```