Function object in spyder not working properly










0














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)









share|improve this question























  • please write an example of your problem and state the expected outcome
    – Glostas
    Nov 9 '18 at 9:50










  • It doesn't seem like you did what it said. Function definition works fine in spyder
    – user8408080
    Nov 9 '18 at 9:59










  • your indentation is wrong
    – Glostas
    Nov 9 '18 at 10:01










  • Manuel, could you please tell me, does the answer I've posted solve your problem? I ask because I'd prefer to remove it if it is not correct or, worse, misleading. Thank you.
    – gboffi
    Nov 9 '18 at 11:16










  • @user8408080 Manuel report is mostly correct, they just had a wrong reason for the buggy behaviour. It's not Spyder in itself, nor the the Python interpreter, but it's an issue with the interactive console used by Spyder, i.e., IPython. See my answer below for details
    – gboffi
    Nov 9 '18 at 11:43















0














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)









share|improve this question























  • please write an example of your problem and state the expected outcome
    – Glostas
    Nov 9 '18 at 9:50










  • It doesn't seem like you did what it said. Function definition works fine in spyder
    – user8408080
    Nov 9 '18 at 9:59










  • your indentation is wrong
    – Glostas
    Nov 9 '18 at 10:01










  • Manuel, could you please tell me, does the answer I've posted solve your problem? I ask because I'd prefer to remove it if it is not correct or, worse, misleading. Thank you.
    – gboffi
    Nov 9 '18 at 11:16










  • @user8408080 Manuel report is mostly correct, they just had a wrong reason for the buggy behaviour. It's not Spyder in itself, nor the the Python interpreter, but it's an issue with the interactive console used by Spyder, i.e., IPython. See my answer below for details
    – gboffi
    Nov 9 '18 at 11:43













0












0








0







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)









share|improve this question















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)






python spyder






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 '18 at 9:55







Manuel Oliveira

















asked Nov 9 '18 at 9:46









Manuel OliveiraManuel Oliveira

197




197











  • please write an example of your problem and state the expected outcome
    – Glostas
    Nov 9 '18 at 9:50










  • It doesn't seem like you did what it said. Function definition works fine in spyder
    – user8408080
    Nov 9 '18 at 9:59










  • your indentation is wrong
    – Glostas
    Nov 9 '18 at 10:01










  • Manuel, could you please tell me, does the answer I've posted solve your problem? I ask because I'd prefer to remove it if it is not correct or, worse, misleading. Thank you.
    – gboffi
    Nov 9 '18 at 11:16










  • @user8408080 Manuel report is mostly correct, they just had a wrong reason for the buggy behaviour. It's not Spyder in itself, nor the the Python interpreter, but it's an issue with the interactive console used by Spyder, i.e., IPython. See my answer below for details
    – gboffi
    Nov 9 '18 at 11:43
















  • please write an example of your problem and state the expected outcome
    – Glostas
    Nov 9 '18 at 9:50










  • It doesn't seem like you did what it said. Function definition works fine in spyder
    – user8408080
    Nov 9 '18 at 9:59










  • your indentation is wrong
    – Glostas
    Nov 9 '18 at 10:01










  • Manuel, could you please tell me, does the answer I've posted solve your problem? I ask because I'd prefer to remove it if it is not correct or, worse, misleading. Thank you.
    – gboffi
    Nov 9 '18 at 11:16










  • @user8408080 Manuel report is mostly correct, they just had a wrong reason for the buggy behaviour. It's not Spyder in itself, nor the the Python interpreter, but it's an issue with the interactive console used by Spyder, i.e., IPython. See my answer below for details
    – gboffi
    Nov 9 '18 at 11:43















please write an example of your problem and state the expected outcome
– Glostas
Nov 9 '18 at 9:50




please write an example of your problem and state the expected outcome
– Glostas
Nov 9 '18 at 9:50












It doesn't seem like you did what it said. Function definition works fine in spyder
– user8408080
Nov 9 '18 at 9:59




It doesn't seem like you did what it said. Function definition works fine in spyder
– user8408080
Nov 9 '18 at 9:59












your indentation is wrong
– Glostas
Nov 9 '18 at 10:01




your indentation is wrong
– Glostas
Nov 9 '18 at 10:01












Manuel, could you please tell me, does the answer I've posted solve your problem? I ask because I'd prefer to remove it if it is not correct or, worse, misleading. Thank you.
– gboffi
Nov 9 '18 at 11:16




Manuel, could you please tell me, does the answer I've posted solve your problem? I ask because I'd prefer to remove it if it is not correct or, worse, misleading. Thank you.
– gboffi
Nov 9 '18 at 11:16












@user8408080 Manuel report is mostly correct, they just had a wrong reason for the buggy behaviour. It's not Spyder in itself, nor the the Python interpreter, but it's an issue with the interactive console used by Spyder, i.e., IPython. See my answer below for details
– gboffi
Nov 9 '18 at 11:43




@user8408080 Manuel report is mostly correct, they just had a wrong reason for the buggy behaviour. It's not Spyder in itself, nor the the Python interpreter, but it's an issue with the interactive console used by Spyder, i.e., IPython. See my answer below for details
– gboffi
Nov 9 '18 at 11:43












2 Answers
2






active

oldest

votes


















0














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






share|improve this answer






















  • (Spyder maintainer here) This is still an issue in IPython 7.1, so I think we need to change something in qtconsole to fix this.
    – Carlos Cordoba
    Nov 9 '18 at 15:53










  • @CarlosCordoba AH! Spyder uses qtconsole... The issue was solved in IPython 7.1 "plain" console. I'll edit my answer because I feel it is still relevant re the diagnosis of the problem, if not for its resolution. Thank you for pointing out my mistake.
    – gboffi
    Nov 9 '18 at 20:29


















0














(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.






share|improve this answer




















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53223311%2ffunction-object-in-spyder-not-working-properly%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    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






    share|improve this answer






















    • (Spyder maintainer here) This is still an issue in IPython 7.1, so I think we need to change something in qtconsole to fix this.
      – Carlos Cordoba
      Nov 9 '18 at 15:53










    • @CarlosCordoba AH! Spyder uses qtconsole... The issue was solved in IPython 7.1 "plain" console. I'll edit my answer because I feel it is still relevant re the diagnosis of the problem, if not for its resolution. Thank you for pointing out my mistake.
      – gboffi
      Nov 9 '18 at 20:29















    0














    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






    share|improve this answer






















    • (Spyder maintainer here) This is still an issue in IPython 7.1, so I think we need to change something in qtconsole to fix this.
      – Carlos Cordoba
      Nov 9 '18 at 15:53










    • @CarlosCordoba AH! Spyder uses qtconsole... The issue was solved in IPython 7.1 "plain" console. I'll edit my answer because I feel it is still relevant re the diagnosis of the problem, if not for its resolution. Thank you for pointing out my mistake.
      – gboffi
      Nov 9 '18 at 20:29













    0












    0








    0






    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






    share|improve this answer














    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







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 9 '18 at 20:39

























    answered Nov 9 '18 at 10:13









    gboffigboffi

    8,85822455




    8,85822455











    • (Spyder maintainer here) This is still an issue in IPython 7.1, so I think we need to change something in qtconsole to fix this.
      – Carlos Cordoba
      Nov 9 '18 at 15:53










    • @CarlosCordoba AH! Spyder uses qtconsole... The issue was solved in IPython 7.1 "plain" console. I'll edit my answer because I feel it is still relevant re the diagnosis of the problem, if not for its resolution. Thank you for pointing out my mistake.
      – gboffi
      Nov 9 '18 at 20:29
















    • (Spyder maintainer here) This is still an issue in IPython 7.1, so I think we need to change something in qtconsole to fix this.
      – Carlos Cordoba
      Nov 9 '18 at 15:53










    • @CarlosCordoba AH! Spyder uses qtconsole... The issue was solved in IPython 7.1 "plain" console. I'll edit my answer because I feel it is still relevant re the diagnosis of the problem, if not for its resolution. Thank you for pointing out my mistake.
      – gboffi
      Nov 9 '18 at 20:29















    (Spyder maintainer here) This is still an issue in IPython 7.1, so I think we need to change something in qtconsole to fix this.
    – Carlos Cordoba
    Nov 9 '18 at 15:53




    (Spyder maintainer here) This is still an issue in IPython 7.1, so I think we need to change something in qtconsole to fix this.
    – Carlos Cordoba
    Nov 9 '18 at 15:53












    @CarlosCordoba AH! Spyder uses qtconsole... The issue was solved in IPython 7.1 "plain" console. I'll edit my answer because I feel it is still relevant re the diagnosis of the problem, if not for its resolution. Thank you for pointing out my mistake.
    – gboffi
    Nov 9 '18 at 20:29




    @CarlosCordoba AH! Spyder uses qtconsole... The issue was solved in IPython 7.1 "plain" console. I'll edit my answer because I feel it is still relevant re the diagnosis of the problem, if not for its resolution. Thank you for pointing out my mistake.
    – gboffi
    Nov 9 '18 at 20:29













    0














    (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.






    share|improve this answer

























      0














      (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.






      share|improve this answer























        0












        0








        0






        (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.






        share|improve this answer












        (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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 10 '18 at 16:37









        Carlos CordobaCarlos Cordoba

        13.5k23866




        13.5k23866



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53223311%2ffunction-object-in-spyder-not-working-properly%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

            Edmonton

            Crossroads (UK TV series)