你遇到过的源代码中最好的注释是什么?


当前回答

我个人最喜欢的是打油诗形式的文档:

        Subclassing made Zope and TR
        much harder to work with by far.
            So before you inherit,
            be sure to declare it
        Adapter, not PyObject*

这可能会破坏这个笑话,但由于它有点晦涩,我将解释:

这里的TR指的是“扭曲的现实”。Zope 2和最初的扭曲。Reality包大量而不幸地使用了多重继承,这可能会使您在看到方法调用时难以理解发生了什么。Zope 3,扭曲自己,扭曲。现实的后继者(包括最近的假想)通常更倾向于组件组合。

其他回答

# To understand recursion, see the bottom of this file 

在文件的底部:

# To understand recursion, see the top of this file
/**
 * If you don't understand this code, you should be flipping burgers instead.
 */

在大学的一次家庭作业中,一位老师特别坚决地要求我们注释代码:

//I wonder if she actually reads these.

当作业被返回时,在注释“是的,我愿意”旁边用红笔写着

// Catching exceptions is for communists

来自Mike Duncan在SQLite上的页面。

// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...