Search code examples
pythonpython-3.xpycharmsuper

python3 super() new style autocompletion in PyCharm


With python3 we no longer need to explicitly set the parent class when calling super:

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

But it seems that PyCharm doesn't know it, because when I try to autocomplete super for some method, it uses old style and I receive this:

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

Is there any way to tell PyCharm to use new style, because I could not find one.
Editor -> General -> Code Completion doesn't provide any way to add/override custom rules.


Solution

  • super live template is outdated in PyCharm (the corresponding ticket in PyCharm's issue tracker).

    I think you can edit it by hand in Preferences/Settings | Editor | Live Templates | Python | super.

    enter image description here