查看python函数定义_python下查看函数原型以及类定义工具

可以用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的函数原型可以很好的指导函数原型,但是找函类定义却

: 不能很好的工作,请问一下大家都是用什么工具查看函数原型以及类定义的啊?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值