在本例中,如何在IDE中使用python中的autocomplete

在本例中,如何在IDE中使用python中的autocomplete,python,autocomplete,pycharm,python-decorators,Python,Autocomplete,Pycharm,Python Decorators,我用这样的装饰器。 但是在本例中,hello方法autocomplete中的something参数在IDE(pycharm)中不起作用。(必须支持python 2.7) 在这种情况下如何使用自动完成 谢谢。在推断参数类型时不分析函数的用法 您可以在文档中指定参数类型: class Event(object): can_i_autocomplete_this = True class App(object): def decorator(self, func):

我用这样的装饰器。 但是在本例中,hello方法autocomplete中的
something
参数在IDE(pycharm)中不起作用。(必须支持python 2.7)

在这种情况下如何使用自动完成


谢谢。

在推断参数类型时不分析函数的用法

您可以在文档中指定参数类型:

class Event(object):
    can_i_autocomplete_this = True

class App(object):
    def decorator(self, func):
        self.func = func
    def call():
        self.func(Event())

app = App()

@app.decorator
def hello(something):
   print(something.can_i_autocomplete_this)

app.call()
或者使用类型暗示语法(从Python 3.5开始):


在推断参数类型时不分析函数的用法

您可以在文档中指定参数类型:

class Event(object):
    can_i_autocomplete_this = True

class App(object):
    def decorator(self, func):
        self.func = func
    def call():
        self.func(Event())

app = App()

@app.decorator
def hello(something):
   print(something.can_i_autocomplete_this)

app.call()
或者使用类型暗示语法(从Python 3.5开始):

可能的重复可能的重复
@app.decorator
def hello(something: Event):
    print(something.can_i_autocomplete_this)