There have been times when I wanted to group portions of a module,
class, or function.  Giving names to each of those groupings would be
useful, and would be appropriate for python-level changes.

That said, it would probably need more proof in the wild first, so the
first step would be getting support in an
editor (such as PyCharm), and the second would be
an informational PEP on how to standardize the
practice, like PEP 257 does for docstrings.
https://www.python.org/dev/peps/pep-0257/

For these steps, you would probably have to use a comment or string
convention, such as #{{{ or ":(group X ", though I suppose an external
file (similar to the stub files for typing) is also possible.

If these take off enough that the line noise gets annoying, that will
prove the need, and getting support from python itself will be a lot
easier.

Example code

:group C
class C1:
    :group emulateFoo
    ...

    :group manageBar
    def xx(self, bar, name, val=None):
        :group setupBar
        ...
        :group actualXX

class C2:
...

:group D
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to