What is Outline Explorer in Spyder?

百般思念 提交于 2019-12-08 05:02:55

问题


I see it referenced, but never explained what it is.

https://docs.spyder-ide.org/editor.html

Googled without success.

https://docs.spyder-ide.org/editor.html "Providing a description to the right of the separator will give that cell its own name in the Outline Explorer." Sounds like something for Navigating cells? Where do I find it? Are there shortcuts for navigating cells you create?

Thanks!


回答1:


in your code you can use this , for examle in spyder before each function ( above line of each function ) write #%% you will see the difference in gui where you will find that block is within a cell/ or it is outlined.

and in outlined winodw ( enable views>panes>outlines) you will see the each block and outlier in code




回答2:


I think the Outline Explorer is made to facilitate navigation inside a long and/or dense Python script. In one look you can see the structure of your script, and you can go directly to whatever was outlined by clicking on it.

From what I've seen until now, outlined elements that will appear in the Outline Explorer are :

  • the name of the script selected in the Editor [Python logo]
  • functions [yellow f logo]
  • classes [blue C logo]
  • inside classes : __init__ [pink _ logo], methods [green M logo]
  • inside functions and class methods : loops (for, while...), conditions (if-elif-else, try-except...)
  • cells (see prashant rana's answer)
  • if __name__ == '__main__' : (allows that "when your script is run by passing it as a command to the Python interpreter, all of the code that is at indentation level 0 gets executed" )
  • comments [grey # logo] (see below)

To make comment markers appear : write #### YourComment. The space between the four hashes and the text is important ; the code works with four hashes or more.

"YourComment" will appear in your Outline Explorer. If it's in a cell , it will remain in the same cell. I use comment markers for sub-titles, and sometimes to mark where I have to re-work some code.



来源:https://stackoverflow.com/questions/54925458/what-is-outline-explorer-in-spyder

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