简体   繁体   中英

## in python using notepad++ syntax coloring

In my editor (notepad++) in Python script edit mode, a line

## is this a special comment or what?

Turns a different color (yellow) than a normal #comment.

What's special about a ##comment vs a #comment?

From the Python point of view, there's no difference. However, Notepad++'s highlighter considers the ## sequence as a STRINGEOL, which is why it colours it this way. See this thread .

I thought the difference had something to do with usage:

#this is a code block header

vs.

##this is a comment

I know Python doesn't care one way or the other, but I thought it was just convention to do it that way.

Also, in a different situations :

Comment whose first line is a double hash:

This is used by doxygen and Fredrik Lundh's PythonDoc. In doxygen, if there's text on the line with the double hash, it is treated as a summary string. I dislike this convention because it seems too likely to result in false positives. Eg, if you comment-out a region with a comment in it, you get a double-hash.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM