You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PyCharm中Python3新式super()自动补全设置问题

设置PyCharm自动补全为Python3新式super()写法

在Python3中,调用super()无需显式指定父类和self参数,新式写法示例:

def __init__(self):
    super().__init__()

若PyCharm自动补全仍生成旧式写法:

def setUp(self):
    super(AutocompleteTestCase, self).setUp()

可通过以下步骤修改设置:

  • 打开PyCharm设置界面:
    • Windows/Linux:按下 Ctrl+Alt+S
    • Mac:按下 Cmd+,
  • 在设置面板中依次导航至:Editor > Code Style > Python
  • 切换到Code Generation标签页
  • 在Super call format下拉菜单中选择Without arguments
  • 点击Apply和OK保存设置

完成后,PyCharm自动补全super()时就会生成符合Python3规范的新式写法。

内容的提问来源于stack exchange,提问作者Bohdan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 03:25:13