Python bug整理

来源:互联网 发布:苹果mac爱奇艺视频 编辑:程序博客网 时间:2024/06/08 06:33

1、TypeError: unbound method test() must be called with file_exist instance as first argument (got RequestHttpHandle instance instead)

涉及到一个bound的概念

class Test:
def func(self,message):
print message

object1=Test()
x=object1.func
x(‘绑定方法对象,实例是隐含的’)

t=Test.func
t(object1,’未绑定的方法对象,需要传递一个实例’)

t(‘未绑定的方法对象,需要传递一个实例’) #错误的调用
TypeError: hanle_file() takes exactly 3 arguments (4 given)

调用函数时的参数使用错误

原创粉丝点击