| 1 | |
| 2 | class Super(object): |
| 3 | attribute = 3 |
| 4 | |
| 5 | def func(self): |
| 6 | return 1 |
| 7 | |
| 8 | class Inner(): |
| 9 | pass |
| 10 | |
| 11 | |
| 12 | class Sub(Super): |
| 13 | #? 13 Sub.attribute |
| 14 | def attribute(self): |
| 15 | pass |
| 16 | |
| 17 | #! 8 ['attribute = 3'] |
| 18 | def attribute(self): |
| 19 | pass |
| 20 | |
| 21 | #! 4 ['def func'] |
| 22 | func = 3 |
| 23 | #! 12 ['def func'] |
| 24 | class func(): pass |
| 25 | |
| 26 | #! 8 ['class Inner'] |
| 27 | def Inner(self): pass |
| 28 | |
| 29 | # ----------------- |
| 30 | # Finding self |
| 31 | # ----------------- |
| 32 | |
| 33 | class Test1: |
| 34 | class Test2: |
| 35 | def __init__(self): |
| 36 | self.foo_nested = 0 |
| 37 | #? ['foo_nested'] |
| 38 | self.foo_ |
| 39 | #? |
| 40 | self.foo_here |
| 41 | |
| 42 | def __init__(self, self2): |
| 43 | self.foo_here = 3 |
| 44 | #? ['foo_here', 'foo_in_func'] |
| 45 | self.foo_ |
| 46 | #? int() |
| 47 | self.foo_here |
| 48 | #? |
| 49 | self.foo_nested |
| 50 | #? |
| 51 | self.foo_not_on_self |
| 52 | #? float() |
| 53 | self.foo_in_func |
| 54 | self2.foo_on_second = '' |
| 55 | |
| 56 | def closure(): |
| 57 | self.foo_in_func = 4. |
| 58 | |
| 59 | def bar(self): |
| 60 | self = 3 |
| 61 | self.foo_not_on_self = 3 |
| 62 | |
| 63 | |
| 64 | class SubTest(Test1): |
| 65 | def __init__(self): |
| 66 | self.foo_sub_class = list |
| 67 | |
| 68 | def bar(self): |
| 69 | #? ['foo_here', 'foo_in_func', 'foo_sub_class'] |
| 70 | self.foo_ |
| 71 | #? int() |
| 72 | self.foo_here |
| 73 | #? |
| 74 | self.foo_nested |
| 75 | #? |
| 76 | self.foo_not_on_self |