Can you give a concrete example instead of an abstract one? It would be
good to see how you are trying to comment your code and why this concept of
"sub comments" is necessary.

Also, I am not sure if it's a PEP thing or not, but it's at least my
opinion that you should avoid arbitrary comment "styling", like doing
#####---- and what not. Especially in the middle of function bodies. There
was a point in my earlier python career when I followed others examples of
doing it to separate classes and free functions within the module, but now
I find it annoying. It's quite noisy, and would be even noisier to find
within a function body. And to me it would seem like if you need that kind
of separation between so many blocks, that maybe the function is too big
and should be refactored? Is the function possibly doing too much work,
which requires you to visually break them down in comments?

Justin

On Thu, Apr 13, 2017, 5:26 AM Rudi Hammad <[email protected]> wrote:

> Hi,
> this is just a weird style question. I often find the need to comment
> something specific inside of a more generic coment. This is what I mean:
>
> # Main comment A
> some code...
> # Sub comment A1
> some code...
> # Sub comment A2
> some code...
>
> # Main comment B
> some code...
> # Sub comment B1
> some code...
> # Sub comment B2
> some code...
>
>
> This way all the comments, make seem like the code is at the same level.
> what I really want is to show that the code in the organized in different
> levels or steps.
> So what I do is something like
>
> # --[ Main comment A ]-- #
> some code...
> # Sub comment A1
> some code...
> # Sub comment A2
> some code...
>
> # --[ Main comment B ]-- #
> some code...
> # Sub comment B1
> some code...
> # Sub comment B2
> some code...
>
> Do you see what I mean?
> But I am not very happy with it. I know this is not relevant at all, but I
> wonder if there is a convention for this. PEP doesn´t go into something
> that specific I think
> I also tried
>
> # -------------------------- #
> #  Main comment A #
> # -------------------------- #
> some code...
> # Sub comment A1
> some code...
> # Sub comment A2
> some code...
>
> # -------------------------- #
> #  Main comment B #
> # ------------------------- #
> some code...
> # Sub comment B1
> some code...
> # Sub comment B2
> some code...
>
> but now I am consuming 4 extra lines for nothing with  #
> -------------------------- #
>
> cheers
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/8d11364b-74aa-4e17-ace4-aeeb5cc26989%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/8d11364b-74aa-4e17-ace4-aeeb5cc26989%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2128b8L7yY9As-RuFU297SfAnsJgsEx%2BDD7_Esc8q4Eg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to