|
 
- UID
- 101
- 帖子
- 184
- 精华
- 34
- 积分
- 269
- 阅读权限
- 150
- 在线时间
- 116 小时
- 注册时间
- 2008-4-3
- 最后登录
- 2010-7-3
|
6#
发表于 2009-7-11 20:48
| 只看该作者
我举一个例子:- >>> def test(a,b,c=True,d=False,*e,**f):
- ... pass
- ...
- >>> import inspect
- >>> inspect.getargspec(test)
- (['a', 'b', 'c', 'd'], 'e', 'f', (True, False))
复制代码 这样的话应该可以解决你的问题了.
再用代码说明你的问题:- >>> class A:
- ... def __init__(self,name):
- ... pass
- ... def display(self,name):
- ... pass
- ...
- >>> a=A('aaaa')
- >>> inspect.getargspec(a.display)
- (['self'], None, None, None)
- >>> class A:
- ... def __init__(self,name):
- ... pass
- ... def display(self,name):
- ... pass
- ...
- >>> a=A('aaaa')
- >>> inspect.getargspec(a.display)
- (['self', 'name'], None, None, None)
复制代码 |
|