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


当前回答

下面的代码是在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)

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

其他回答

//把这个放在这里的人是个白痴…这根本不管用!

但是代码还在那里……

下面是一个必须声明的局部变量,只是为了将一个常量传递给库函数:

// This only exists because Scott doesn't know how to use const correctly
// Catching exceptions is for communists

来自Mike Duncan在SQLite上的页面。

// human madable inconvenient. Way too sucks.

我仍然没有完全理解它的含义,但我发现它对于许多代码来说是非常正确的。

    #Christmas tree initializer  
    toConnect = []  
    toRead =   [  ]  
    toWrite = [    ]   
    primes = [      ]  
    responses = {}  
    remaining = {}