3 ms·
I think another exception (in addition to the already mentioned help with an otherwise difficult syntax) is when comments are used to visually represent logical
by cema 13y ago
I think another exception (in addition to the already mentioned help with an otherwise difficult syntax) is when comments are used to visually represent logical segments of the code. Some style guides suggest to write these in all caps. Eg:
# CONFIG
...
# LOCALS
...
# EDGE CASES
...
# REFORMAT INPUT
...
# MAIN ALGORITHM
...
Etc.
- h2s 13y agoRather than an exception, I think this is an example of the precise scenario in which it's most inappropriate to use comments. > visually represent logical segments of the code This is exactly the use case in which function definitions excel. Use functions for this, not comments.
- akkartik 13y agoYeah. A past HN discussion caused me to realize that comments are often used for two independent purposes: structure and commentary. Conflating the two has caused many conversations with the participants talking past each other. http://akkartik.name/post/2012-11-24-18-10-36-soc http://akkartik.name/post/2012-11-24-18-10-36-soc