2017-03-12 | Paul Boddie | file changeset files shortlog | Merged changes from the default branch. | return-value-definition |
paul@2 | 1 | def f(): |
paul@2 | 2 | s = "test" |
paul@2 | 3 | m = s.__len__ |
paul@2 | 4 | n = "test".__len__ |
paul@266 | 5 | print m # __builtins__.str.basestring.__len__ |
paul@266 | 6 | print m() # 4 |
paul@266 | 7 | print n # __builtins__.str.basestring.__len__ |
paul@199 | 8 | print n() |
paul@2 | 9 | |
paul@2 | 10 | def g(): |
paul@266 | 11 | l = [1, 2] |
paul@2 | 12 | m = l.__len__ |
paul@266 | 13 | n = [1, 2].__len__ |
paul@266 | 14 | print l # [1, 2] |
paul@266 | 15 | print m # __builtins__.list.list.__len__ |
paul@266 | 16 | print m() # 2 |
paul@266 | 17 | print n # __builtins__.list.list.__len__ |
paul@266 | 18 | print n() # 2 |
paul@2 | 19 | |
paul@2 | 20 | f() |
paul@2 | 21 | g() |