Function object in spyder not working properly

我怕爱的太早我们不能终老 提交于 2019-12-11 17:07:51

问题


When I am building a function in python, using spyder, the function object is not working properly.

e.g.,

def first_order(y,t):
    tau=5

After introducing the 2nd line it automatically closes the function. How can I change this behavior?

It used to be like this

    def first_order(y,t):

>             tau=5 
    ...: (first Enter, creates a new line)
(second Enter, to close the function)

回答1:


Spyder uses IPython in its interactive console. What you report is a bug in IPython 7.0, so the cleanest solution is to upgrade to IPython 7.1.

As a stop gap measure, if your platform doesn't provide 7.1 yet, you can use the key-chord Ctrl-o (instead of Return) to open a new line below the second line of the function definition and move there using the cursor key — after this maneuver the situation will be normal for the rest of the function definition.

Update

I knew that Spyder uses IPython, I didn't knew that it uses it via the qtconsole and the bug I described was still not fixed in 7.1 qtconsole (thank you Carlos Cordoba for pointing out).

The reason why OP has a problem still stands as valid, I fear that we have to wait 7.2 to have a fix for the qtconsole because the ad interim solution that I've described doesn't work in qtconsole




回答2:


(Spyder maintainer here) This is a bug in the Qtconsole package and it'll be fixed in its 4.4.3 version, to be released today.



来源:https://stackoverflow.com/questions/53223311/function-object-in-spyder-not-working-properly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!