简体   繁体   English

Eclipse + PyDev基于函数调用定义函数

[英]Eclipse + PyDev define function based on function call

I have noticed a particular feature in Visual Studio and I am wondering if this feature is also available in Eclipse + PyDev. 我注意到Visual Studio中有一个特殊功能,我想知道Eclipse + PyDev中是否也提供了此功能。

In Visual Studio, if one were to type a function call and that particular function does not already exist, VS would show a code error and give an option to generate a new empty function matching the signature provided in the function call. 在Visual Studio中,如果要键入一个函数调用而该特定函数尚不存在,则VS将显示代码错误,并提供一个选项来生成与该函数调用中提供的签名匹配的新的空函数。

In other words, same I am working in a particular Python function or class and I realize I need a new function to process some string. 换句话说,我正在使用特定的Python函数或类,并且意识到我需要一个新函数来处理某些字符串。 In my current function I type processString(myString) , which returns an error because the processString function does not currently exist. 在当前函数中,键入processString(myString) ,由于processString函数当前不存在,该方法返回错误。 Is there some way to then click on the processString function call and create a new block in my module: 有什么方法可以单击processString函数调用并在我的模块中创建一个新块:

def processString(myString):
    pass

Thanks in advance for your help. 在此先感谢您的帮助。

Thank you @Eric Wilson. 谢谢@埃里克·威尔逊。

If I type the function call processString(myString) then hit 'CTRL+1' the code completion/template window appears offering me the option to create a new class, method, assign to a field, or assign to a variable. 如果我键入函数调用processString(myString)然后按“ CTRL + 1”,则会出现代码完成/模板窗口,该窗口为我提供了创建新类,方法,分配给字段或分配给变量的选项。

This was exactly what I was looking for. 这正是我想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM