python同名函数同名参数问题

如果python有两个函数的函数名与参数列表都相同那么调用该函数时,哪个函数在后,则哪个被最终调用。

举例如下:

def test():
    print "before hello"

def test():
    print "after hello"

if __name__ == '__main__':
    test()

结果:

def test():
    print "after hello"
    
def test():
    print "before hello"


if __name__ == '__main__':
    test()

结果:

原文地址:https://www.cnblogs.com/guozw/p/8732502.html