python - Pycharm 热键/设置将 *args 调用更改为 **kwargs 调用
问题描述
假设我想覆盖__init__
它的后代中的某个类,即
class Parent:
def __init__(self, arg1, arg2, arg3):
...
...
class Child(Parent):
def __init__(self, arg1, arg2, arg3):
super().__init__(arg1, arg2, arg3)
...
如果我创建子类,然后按下Ctrl+O
并选择覆盖__init__
PyCharm 将生成类似上述代码的内容。但我想用**kwargs
init 而不是调用父级*args
:
# instead of this
# super().__init__(arg1, arg2, arg3)
# I want this (by settings/hotkey)
super().__init__(arg1=arg1, arg2=arg2, arg3=arg3)
有什么建议么?
解决方案
推荐阅读
- sql - 如何在 Oracle 中找到最小学期?
- php - Laravel 弹力豆茎
- python - 如何修复此 Visual Studio 代码路径错误?
- php - 我必须将 print_r() 的输出显示到表中,但我不能这样做。如果我将该数组存储在简单的变量中,那么我将能够打印。哪里出错了?
- python - Networkx 和 GIS,将单独的节点/边连接到更大的节点/边集
- selenium - 移动使用没有 Appium 的网络应用自动化?
- https - htaccess - 使用查询重定向到 https
- angular - 如何解决此错误“错误类型错误:无法删除 [object Array] 的属性 '0'”
- java - 在回收站视图 Android 中禁用滚动后移至下一项
- flutter - SliverList SliverChildBuilderDelegate 中的 ListView.builder 在首次加载时不呈现图像