Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dividing Python module into multiple regions

In C# we can create regions by using

#region // some methods #endregion 

Is there any way to format python code in similar fashion so that I can keep all my relevant methods in one block?

like image 881
gsagrawal Avatar asked Nov 25 '11 06:11

gsagrawal


1 Answers

Looks like PyCharm has it, see here: https://www.jetbrains.com/help/pycharm/2016.1/code-folding.html#using_folding_comments

For Python files, the following two styles are supported. You should not mix both of them in a single file.

#<editor-fold desc="Description"> ... #</editor-fold> 

or

#region Description ... #endregion 

Visual Studio accepts "region" too

like image 159
CSJ Avatar answered Sep 21 '22 07:09

CSJ