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


当前回答

def format_ticket_content(text, recursive = true)
  if text.is_a?(TicketNote)
    note = text
    text = note.content
  else
    note = nil
  end

  ## Safety pig has arrived!
  text = h(text)
  ##                               _
  ##  _._ _..._ .-',     _.._(`))
  ## '-. `     '  /-._.-'    ',/
  ##    )         \            '.
  ##   / _    _    |             \
  ##  |  a    a    /              |
  ##  \   .-.                     ;  
  ##   '-('' ).-'       ,'       ;
  ##      '-;           |      .'
  ##         \           \    /
  ##         | 7  .__  _.-\   \
  ##         | |  |  ``/  /`  /
  ##        /,_|  |   /,_/   /
  ##           /,_/      '`-'
  ## 

其他回答

aComment = 'this is not aComment' # this is aComment
class T(object):
    def f(this):
        this is not aComment

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

// This only exists because Scott doesn't know how to use const correctly
// I don't know why I need this, but it stops the people being upside-down

x = -x;
/* Halley's comment */
// I have to find a better job