可以用inspect模块
In [1]: import inspect
In [2]: import os
In [3]: print inspect.getsource(os.path.isfile)
def isfile(path):
"""Test whether a path is a regular file"""
try:
st = os.stat(path)
except os.error:
return False
return stat.S_ISREG(st.st_mode)
或者IPython的?和??
In [4]: os.path.isfile??
Type: function
Base Class:
String Form:
Namespace: Interactive
File: /usr/lib/python2.7/genericpath.py
Definition: os.path.isfile(path)
Source:
def isfile(path):
"""Test whether a path is a regular file"""
try:
st = os.stat(path)
except os.error:
return False
return stat.S_ISREG(st.st_mode)
或者用WingIDE(商业软件),鼠标一点,就跳转了。。。
【 在 leoadu (adu) 的大作中提到: 】
: 标 题: python下查看函数原型以及类定义工具
: 发信站: 水木社区 (Mon Nov 28 11:00:14 2011), 转信
: 现在用ctags,cscope查看python的函数原型可以很好的指导函数原型,但是找函类定义却
: 不能很好的工作,请问一下大家都是用什么工具查看函数原型以及类定义的啊?