Tor Norbye | 1aa2e09 | 2014-08-20 17:01:23 -0700 | [diff] [blame] | 1 | class MyClass(object): |
| 2 | def method(self): |
| 3 | pass |
| 4 | |
| 5 | @staticmethod |
| 6 | def static_method(): |
| 7 | pass |
| 8 | |
| 9 | |
| 10 | # Unbound method still treated as __method in Python 2 |
| 11 | MyClass.method.__func__ |
| 12 | MyClass.method.<warning descr="Cannot find reference '__defaults__' in 'function'">__defaults__</warning> |
| 13 | |
| 14 | # Bound method with qualifier |
| 15 | inst = MyClass() |
| 16 | inst.method.__func__ |
| 17 | inst.method.<warning descr="Cannot find reference '__defaults__' in 'function'">__defaults__</warning> |
| 18 | |
| 19 | # Reassigned bound method without qualifier |
| 20 | m = inst.method |
| 21 | |
| 22 | # Static method |
| 23 | # This reference should be marked as unresolved, but such warnings are suppressed for methods with decorators |
| 24 | inst.static_method.__func__ |
| 25 | inst.static_method.__defaults__ |