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


当前回答

下面的代码是在Python模拟教程中看到的。

# This is my rifle.
def rifle(type='hunting'):
    print('This is my (%s) rifle.' % type)

# This is my gun.
def gun(type='hand'):
    print('This is my (%s) gun.' % type)

# This is for fighting.
def fighting(type='illegal'):
    print('This is for (%s) fighting.' % type)

# This is for fun.
def fun(type='gaming'):
    print('This is for (%s) fun.' % type)

作者一定是《恶搞之家》的粉丝。^ _ ^

其他回答

我前几天刚检查过这个…

/// <STERNLY-WORDED-WARNING>
/// Pay attention to this or I will hunt you down.
/// ...
/// </STERNLY-WORDED-WARNING>

(“……”== "专有的东西,我不能发布")。我只是喜欢我的措辞严厉的警告元素。

/* My lawyer told me not to reveal */
/// <summary>
/// The possible outcomes of an update operation (save or delete)
/// </summary>
public enum UpdateResult
{

    /// <summary>
    /// Updated successfully
    /// </summary>
    Success = 0,

    /// <summary>
    /// Updated successfully
    /// </summary>
    Failed = 1
}
int main(void)
/* Program starts here */
// I know the line below is wrong, but it came that way from our IP vendor, and 
// the driver won't work if you "fix" it. I've had to revert this change 4 times
// now. Leave it alone, or I will hunt you down and hurt you
if (r = 0) {
    /* bunch of code here */
}
else
{
   /* even more code here */
}