def main(): print('START') # print(dir(rect)) rec = rect.PyRectangle(1, 2, 3, 4) try: rec_area = rec.get_area() print(rec_area) finally: del rec
import rect if __name__ == '__main__': pyRect = rect.PyRectangle(100, 100, 300, 500) width, height = pyRect.get_size() print("Area: width(%d) x height(%d) = %d" % (width, height, width * height))
# -*- coding: utf-8 -*- """ Created on Tue Oct 9 19:26:34 2018 @author: bdebaque """ # %% import rect x0, y0, x1, y1 = 1, 2, 3, 4 rect_obj = rect.PyRectangle(x0, y0, x1, y1) print((rect_obj.get_area()))
import rect if __name__ == '__main__': rect = rect.PyRectangle(0, 0, 2, 2) area = rect.get_area() assert(area == 4) print('rectangle: (0, 0, 2, 2), area: {}'.format(area))
import rect print(rect.__pyx_capi__) # {'foo': <capsule object "int (int)" at 0x7f28e02f27e0>, # 'getArea': <capsule object "int (shapes::Rectangle)" at 0x7f28e02f2c90>, # 'get_area_cy': <capsule object "int (struct cPyRectangle *)" at 0x7f28e02f2120>} r = rect.PyRectangle(1, 2, 3, 4) print(r.__pyx_vtable__) # <capsule object NULL at 0x7f28e02f2fc0>
import rect rect_obj = rect.PyRectangle(1, 2, 3, 4) rect_obj.get_area() dir(rect_obj) print(rect_obj.sumVec([1, 1, 1]))