python与c的比较-C,C++和Python的性能比较(2)

#include

PyObject*

wrap_testFor(PyObject* self,PyObject* args)

{

testFor();

Py_INCREF(Py_None);

return Py_None;

}

PyObject*

wrap_testAdd(PyObject* self,PyObject* args)

{

testAdd();

Py_INCREF(Py_None);

return Py_None;

}

PyObject*

wrap_testSubtract(PyObject* self,PyObject* args)

{

testSubtract();

Py_INCREF(Py_None);

return Py_None;

}

PyObject*

wrap_testMultiply(PyObject* self,PyObject* args)

{

testMultiply();

Py_INCREF(Py_None);

return Py_None;

}

PyObject*

wrap_testDivide(PyObject* self,PyObject* args)

{

testDivide();

Py_INCREF(Py_None);

return Py_None;

}

PyObject*

wrap_testDivide2(PyObject* self,PyObject* args)

{

testDivide2();

Py_INCREF(Py_None);

return Py_None;

}

PyObject*

wrap_testVar(PyObject* self,PyObject* args)

{

testVar();

Py_INCREF(Py_None);

return Py_None;

}

PyObject*

wrap_testIf(PyObject* self,PyObject* args)

{

testIf();

Py_INCREF(Py_None);

return Py_None;

}

PyObject*

wrap_testReadGlobal(PyObject* self,PyObject* args)

{

testReadGlobal();

Py_INCREF(Py_None);

return Py_None;

}

staticPyMethodDef exampleMethods[] = {

{"testFor",wrap_testFor,METH_VARARGS,"test For() time"},

{"testAdd",wrap_testAdd,METH_VARARGS,"test Add() time"},

{"testSubtract",wrap_testSubtract,METH_VARARGS,"test Subtract() time"},

{"testMultiply",wrap_testMultiply,METH_VARARGS,"test Multiply() time"},

{"testDivide",wrap_testDivide,METH_VARARGS,"test Divide() time"},

{"testDivide2",wrap_testDivide2,METH_VARARGS,"test Divide2() time"},

{"testVar",wrap_testVar,METH_VARARGS,"test Var() time"},

{"testIf",wrap_testIf,METH_VARARGS,"test If() time"},

{"testReadGlobal",wrap_testReadGlobal,METH_VARARGS,"test ReadGlobal() time"},

{NULL,NULL}

};

voidinitexample()

{

PyObject* m;

m = Py_InitModule("example",exampleMethods);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值