File: method_object.py

package info (click to toggle)
python-lsp-rope 0.1.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 340 kB
  • sloc: python: 2,319; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 274 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def add(a, b):
    return NewMethodObject(a, b)()


class NewMethodObject(object):

    def __init__(self, a, b):
        self.a = a
        self.b = b

    def __call__(self):
        return self.a + self.b


def main():
    a, b = 10, 20
    print(f"{a} + {b} = {a + b}")