2017-03-20 | Paul Boddie | file changeset files shortlog | Added the context identity to the AttrResult string representation. |
paul@2 | 1 | class C: |
paul@2 | 2 | def m(self): |
paul@2 | 3 | return 1 |
paul@2 | 4 | |
paul@2 | 5 | D = C # alias for C |
paul@2 | 6 | |
paul@266 | 7 | print C # __main__.C |
paul@266 | 8 | print D # __main__.C |
paul@248 | 9 | |
paul@2 | 10 | class E: |
paul@2 | 11 | def m(self): |
paul@2 | 12 | return 2 |
paul@2 | 13 | |
paul@2 | 14 | F = E # alias for E |
paul@2 | 15 | |
paul@266 | 16 | print E # __main__.E |
paul@266 | 17 | print F # __main__.E |
paul@248 | 18 | |
paul@2 | 19 | def f(): |
paul@2 | 20 | c = C |
paul@2 | 21 | d = D # C |
paul@2 | 22 | cm = C.m |
paul@2 | 23 | dm = D.m # C.m |
paul@2 | 24 | |
paul@266 | 25 | print c # __main__.C |
paul@266 | 26 | print d # __main__.C |
paul@266 | 27 | print cm # __main__.C.m |
paul@266 | 28 | print dm # __main__.C.m |
paul@248 | 29 | |
paul@2 | 30 | c = E |
paul@2 | 31 | d = F # E |
paul@2 | 32 | cm = E.m |
paul@2 | 33 | dm = F.m # E.m |
paul@2 | 34 | |
paul@266 | 35 | print c # __main__.E |
paul@266 | 36 | print d # __main__.E |
paul@266 | 37 | print cm # __main__.E.m |
paul@266 | 38 | print dm # __main__.E.m |
paul@248 | 39 | |
paul@248 | 40 | f() |
paul@248 | 41 | |
paul@2 | 42 | Cm = C.m |
paul@2 | 43 | Dm = D.m |
paul@2 | 44 | Em = E.m |
paul@2 | 45 | Fm = F.m |
paul@2 | 46 | |
paul@266 | 47 | print Cm # __main__.C.m |
paul@266 | 48 | print Dm # __main__.C.m |
paul@266 | 49 | print Em # __main__.E.m |
paul@266 | 50 | print Fm # __main__.E.m |
paul@248 | 51 | |
paul@2 | 52 | def g(): |
paul@2 | 53 | Cm = E.m |
paul@2 | 54 | Dm = F.m # E.m |
paul@2 | 55 | |
paul@266 | 56 | print Cm # __main__.E.m |
paul@266 | 57 | print Dm # __main__.E.m |
paul@248 | 58 | |
paul@248 | 59 | g() |
paul@248 | 60 | |
paul@2 | 61 | def h(): |
paul@2 | 62 | global Em, Fm |
paul@2 | 63 | Em = C.m |
paul@2 | 64 | Fm = D.m # C.m |
paul@2 | 65 | |
paul@266 | 66 | print Em # __main__.C.m |
paul@266 | 67 | print Fm # __main__.C.m |
paul@248 | 68 | |
paul@248 | 69 | h() |
paul@248 | 70 | |
paul@266 | 71 | print Em # __main__.C.m |
paul@266 | 72 | print Fm # __main__.C.m |
paul@251 | 73 | |
paul@2 | 74 | Ci = C() |
paul@2 | 75 | Ei = E() |
paul@2 | 76 | |
paul@266 | 77 | print Ci # <__main__.C instance> |
paul@266 | 78 | print Ei # <__main__.E instance> |
paul@248 | 79 | |
paul@2 | 80 | def i(): |
paul@2 | 81 | c = Ci |
paul@266 | 82 | print c # <__main__.C instance> |
paul@2 | 83 | c = Ei |
paul@266 | 84 | print c # <__main__.E instance> |
paul@248 | 85 | |
paul@248 | 86 | i() |
paul@2 | 87 | |
paul@2 | 88 | def j(): |
paul@2 | 89 | global Ei |
paul@2 | 90 | Ei = C() |
paul@266 | 91 | print Ei # <__main__.C instance> |
paul@248 | 92 | |
paul@248 | 93 | j() |
paul@2 | 94 | |
paul@266 | 95 | print Ei # <__main__.C instance> |
paul@251 | 96 | |
paul@2 | 97 | L = [] |
paul@2 | 98 | M = [1] |
paul@2 | 99 | |
paul@248 | 100 | print L # [] |
paul@248 | 101 | print M # [1] |
paul@248 | 102 | |
paul@2 | 103 | def k(): |
paul@2 | 104 | c = L |
paul@248 | 105 | print c # [] |
paul@248 | 106 | |
paul@248 | 107 | k() |
paul@2 | 108 | |
paul@2 | 109 | def l(): |
paul@2 | 110 | global M |
paul@2 | 111 | M = [] |
paul@248 | 112 | print M # [] |
paul@248 | 113 | |
paul@248 | 114 | l() |
paul@248 | 115 | print M # [] |