在很多代码中,我看到了一些在类中定义了函数,但只是使用
我知道 `pass` 什么也不做,这有点冷漠和无用,还有 `null` 表达式,但为什么程序员会使用这样的函数?
此外,还有一些函数使用 `return ""` ,比如:
为什么程序员使用这些东西?
pass
语句并附带一些注释。就像Python中的本机内置函数一样:def copyright(*args, **kwargs): # real signature unknown
"""
interactive prompt objects for printing the license text, a list of
contributors and the copyright notice.
"""
pass
我知道 `pass` 什么也不做,这有点冷漠和无用,还有 `null` 表达式,但为什么程序员会使用这样的函数?
此外,还有一些函数使用 `return ""` ,比如:
def bin(number): # real signature unknown; restored from __doc__
"""
bin(number) -> string
Return the binary representation of an integer.
>>> bin(2796202)
'0b1010101010101010101010'
"""
return ""
为什么程序员使用这些东西?