Python论坛  - 讨论区

标题:[python-chinese] ?????????????

2005年07月29日 星期五 17:27

yangfreecode yangfreecode at sohu.com
Fri Jul 29 17:27:33 HKT 2005




[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年07月29日 星期五 17:55

xu.shengyong zjxushengyong at hotmail.com
Fri Jul 29 17:55:31 HKT 2005

我用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

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年07月29日 星期五 18:23

老K koria at 163.com
Fri Jul 29 18:23:01 HKT 2005

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

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2005年07月29日 星期五 20:19

MakeYunBad makeyoubad163 at 163.com
Fri Jul 29 20:19:21 HKT 2005

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

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号