简体   繁体   English

使用notepad ++语法着色的python中的##

[英]## in python using notepad++ syntax coloring

In my editor (notepad++) in Python script edit mode, a line 在我的编辑器(notepad ++)中用Python脚本编辑模式,一行

## is this a special comment or what?

Turns a different color (yellow) than a normal #comment. 变为与正常#comment不同的颜色(黄色)。

What's special about a ##comment vs a #comment? ##评论与#comment有什么特别之处?

From the Python point of view, there's no difference. 从Python的角度来看,没有区别。 However, Notepad++'s highlighter considers the ## sequence as a STRINGEOL, which is why it colours it this way. 但是,Notepad ++的荧光笔将##序列视为STRINGEOL,这就是为什么它以这种方式着色。 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. 我知道Python不关心这种或那种方式,但我认为这样做只是惯例。

Also, in a different situations : 此外,在不同的情况下

Comment whose first line is a double hash: 注释的第一行是双哈希:

This is used by doxygen and Fredrik Lundh's PythonDoc. 这是由doxygen和Fredrik Lundh的PythonDoc使用的。 In doxygen, if there's text on the line with the double hash, it is treated as a summary string. 在doxygen中,如果带有双重哈希的行上有文本,则将其视为摘要字符串。 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. 例如,如果您注释掉带有注释的区域,则会得到双重哈希。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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