summaryrefslogtreecommitdiff
path: root/pypers/oxford/ex.py
blob: 3868a1efac01a0d654f9fba3393ad12f7fd9f558 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Base(object):
    def __init__(self):
        print "B.__init__"

class MyClass(Base):
    "I do not cooperate with others"
    def __init__(self):
        print "MyClass.__init__"
        Base.__init__(self)  #instead of super(MyClass, self).__init__()


class Mixin(Base):
    "I am cooperative with others"
    def __init__(self):
        print "Mixin.__init__"
        super(Mixin, self).__init__()


class HerClass(MyClass, Mixin):
    "I am cooperative too"
    def __init__(self):
        print "HerClass.__init__"
        super(HerClass, self).__init__()


h = HerClass()