2005年07月29日 星期五 17:27
2005年07月29日 星期五 17:55
我用C写了一个Python的扩展库MyExtension.dll,其中包括了两个函数: static PyObject* MyStrLen(PyObject *self, PyObject *args) static PyObject* MyStrCat(PyObject *self, PyObject *args) 那我在PythonWin下面通过属性 __dict__ 就可以获得扩展库MyExtension.dll的相关信息: >>> from MyExtension import * >>> MyExtension.__dict__ {'__name__': 'MyExtension', '__file__': 'D:\\Tools\\ActivePython\\DLLs\\MyExtension.dll', 'MyStrLen':, '__doc__': None, 'MyStrCat': } 而我现在想获得调用函数MyStrLen或MyStrCat所需要的参数信息,应该通过哪个属性来获取,有没有这种方法,谢谢! 下面附加的是Python Manual中关于Python各种数据类型的属性: __dict__ :A dictionary or other mapping object used to store an object's (writable) attributes. __methods__ :Use the built-in function dir() to get a list of an object's attributes. This attribute is no longer available. __members__ :Use the built-in function dir() to get a list of an object's attributes. This attribute is no longer available. __class__ :The class to which a class instance belongs. __bases__ :The tuple of base classes of a class object. If there are no base classes, this will be an empty tuple. __name__ :The name of the class or type. func_doc:The function's documentation string, or None if unavailable Writable __doc__ Another way of spelling func_doc Writable func_name:The function's name Writable __name__:Another way of spelling func_name Writable __module__:The name of the module the function was defined in, or None if unavailable. Writable func_defaults:Atuple containing default argument values for those arguments that have defaults, or None if no arguments have a default value Writable func_code:The code object representing the compiled function body. Writable func_globals:A reference to the dictionary that holds the function's global variables -- the global namespace of the module in which the function was defined. Read-only func_dict:The namespace supporting arbitrary function attributes. Writable func_closure:None or a tuple of cells that contain bindings for the function's free -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050729/3daeda69/attachment-0001.html
2005年07月29日 星期五 18:23
xu.shengyong,您好! 应该可以通过在你那个函数里添加__doc__字窜来做说明实现。 ======== 2005-07-29 17:55:31 您在来信中写道: ======== 我用C写了一个Python的扩展库MyExtension.dll,其中包括了两个函数: static PyObject* MyStrLen(PyObject *self, PyObject *args) static PyObject* MyStrCat(PyObject *self, PyObject *args) 那我在PythonWin下面通过属性 __dict__ 就可以获得扩展库MyExtension.dll的相关信息: >>> from MyExtension import * >>> MyExtension.__dict__ {'__name__': 'MyExtension', '__file__': 'D:\\Tools\\ActivePython\\DLLs\\MyExtension.dll', 'MyStrLen':, '__doc__': None, 'MyStrCat': } 而我现在想获得调用函数MyStrLen或MyStrCat所需要的参数信息,应该通过哪个属性来获取,有没有这种方法,谢谢! 下面附加的是Python Manual中关于Python各种数据类型的属性: __dict__ :A dictionary or other mapping object used to store an object's (writable) attributes. __methods__ :Use the built-in function dir() to get a list of an object's attributes. This attribute is no longer available. __members__ :Use the built-in function dir() to get a list of an object's attributes. This attribute is no longer available. __class__ :The class to which a class instance belongs. __bases__ :The tuple of base classes of a class object. If there are no base classes, this will be an empty tuple. __name__ :The name of the class or type. func_doc:The function's documentation string, or None if unavailable Writable __doc__ Another way of spelling func_doc Writable func_name:The function's name Writable __name__:Another way of spelling func_name Writable __module__:The name of the module the function was defined in, or None if unavailable. Writable func_defaults:Atuple containing default argument values for those arguments that have defaults, or None if no arguments have a default value Writable func_code:The code object representing the compiled function body. Writable func_globals:A reference to the dictionary that holds the function's global variables -- the global namespace of the module in which the function was defined. Read-only func_dict:The namespace supporting arbitrary function attributes. Writable func_closure:None or a tuple of cells that contain bindings for the function's free = = = = = = = = = = = = = = = = = = = = = = 致 礼! 老K koria at 163.com 2005-07-29 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050729/29fc130b/attachment.htm
2005年07月29日 星期五 20:19
yllgmail,您好! 有我一个 ======== 2005-07-28 14:40:08 您在来信中写道: ======== 我在大连,呵呵 ----- Original Message ----- From: cuiyl To: python chinese Sent: Thursday, July 28, 2005 2:18 PM Subject: [python-chinese] 问大家一个问题!! 大家有在大连的吗? _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese = = = = = = = = = = = = = = = = = = = = = = 致 礼! MakeYunBad makeyoubad163 at 163.com 2005-07-29 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050729/74477392/attachment.html
Zeuux © 2025
京ICP备05028076号