V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
fangwenxue
V2EX  ›  问与答

Python 有类似 PHP 的注释没?

  •  
  •   fangwenxue · Jul 10, 2020 · 1209 views
    This topic created in 2116 days ago, the information mentioned may be changed or developed.
    PHP
    
    /**
     * @property \yii\web\AssetManager $assetManager The asset manager application component. This property is
     * read-only.
     * @property \yii\rbac\ManagerInterface $authManager The auth manager application
     */
     phpstorm 会有上面定义的变量提示
     Yii::app()->
    
       def __getattr__(self, item):
            def call_back(*args, **kwargs):
                func = getattr(self.one, item)
                return func(*args, **kwargs)
    
            return call_back
    
    • 如何让 pycharm obj. 点的时候提示类方法列表
    • 很多方法代码基本都一样, 所以写成了魔术方法, 但用类 点的时候不知道有哪些方法
    • 怎样让 pycharm 出现方法列表的提示
    2 replies    2020-07-10 18:28:32 +08:00
    fcmio
        1
    fcmio  
       Jul 10, 2020 via iPhone
    你看看别人写的模块代码的注释……
    iyaozhen
        2
    iyaozhen  
       Jul 10, 2020
    Python 注释规范有几套 级随便看一套,然后 IDE 里面选对应的注释规范

    主要注释关键字 type,类似这样

    :param request:
    :type request: Message
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6098 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 02:08 · PVG 10:08 · LAX 19:08 · JFK 22:08
    ♥ Do have faith in what you're doing.