Add more useful help for special name in `help()`
未關閉
還沒有人認領這個 Issue。
interpreter-core
type-feature
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Feature or enhancement
Proposal:
Now, use help("__name__") and some other special variables' names will still get the help from their class. I think that we can add the useful help on them. For example:
>>>help("__name__")
1. module.__name__ : if the module is run as the main module, the value is ‘_main_‘, or the name is the filename of the module. For example:if __name__ == "__main__": ...can control which code don’t run when the module is imported.
2. cls.__name__: the name of the class. It must be str.
For other special variables (such as __file__), we can alse print the similar detailed help. And I think that the sentences need to be friendly.
Also welcome to give the ideals on new ideas
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
- gh-137966
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先執行 help("name"),並將其目前的輸出與針對 name 和 file 提出的範例進行比較。當 help() 為所選的特殊變數提供友善且有用的說明時,即表示完成;開始之前請先查看連結的 PR gh-137966。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- documentation
- Issue 類型
- 功能
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100