[Q] 如何列出python 模組中的方法?
http://stackoverflow.com/questions/139180/listing-all-functions-in-a-python-module
$ dir(modulename)
to see all available methods/attributes
$ import modulename
$ help(modulename)
//=== https://docs.python.org/2/faq/windows.html#is-a-pyd-file-the-same-as-a-dll
pyd 與 dll 的分別
" ... If you have a DLL named foo.pyd, then it must have a function initfoo() .... "
[例]
extern "C" __declspec(dllexport) void initmyrandom(void) {
Py_InitModule("myrandom", MTPRNGMethods);
}
*** 模組名稱, 檔案名稱, 函數名稱 三者需一致
" ... “import foo” ...
Python will search for foo.pyd (as well as foo.py, foo.pyc) ...
will attempt to call initfoo() to initialize it.
"
*** foo.pyd is not required if "import foo" is not called
"... the search path for foo.pyd is PYTHONPATH, not the same as the path that Windows uses to search for foo.dll. ..."
???
" ... In a DLL, linkage is declared in the source code with __declspec(dllexport).
In a .pyd, linkage is defined in a list of available functions....
"
沒有留言:
張貼留言