pycharm的python_stubs

最近在写udp socket程序时,对几个函数(如sendto)command+左击时,发现跳转到了这个python文件里面去了。(默认应该是到函数源码那里)

/PyCharm2018.1/python_stubs/160944109/_socket.py

定义了如下的伪函数

    def send(self, data, flags=None): # real signature unknown; restored from __doc__
        """
        send(data[, flags]) -> count

        Send a data string to the socket.  For the optional flags
        argument, see the Unix manual.  Return the number of bytes
        sent; this may be less than len(data) if the network is busy.
        """
        pass

    def sendall(self, data, flags=None): # real signature unknown; restored from __doc__
        """
        sendall(data[, flags])

        Send a data string to the socket.  For the optional flags
        argument, see the Unix manual.  This calls send() repeatedly
        until all data is sent.  If an error occurs, it's impossible
        to tell how much data has been sent.
        """
        pass

google了下,发现已经有人在stackoverflow提出相关问题,我这里简单提炼一下。

https://stackoverflow.com/questions/24266114/pycharm-what-is-python-stubs

什么情况下会出现跳转到python_stubs?

当我们调用的函数是内置函数或仅二进制存在的函数(没有py文件,只有pyc等)时,pycharm会对某个版本进行硬编码而生成的伪函数(实际不是调用的这个,只是方便我们做开发)。

想一想pycharm为了方便我们,真是煞费苦心。

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值