最近看到一段代码就产生了疑问python中function是以什么形式的存在呢?
class?
代码如下
def test():
pass
test.a = 100
test.b = 200
居然还可以给function赋值? 这个不是之前class的功能吗???
dir(test) 之后发现返回的是一个list
求指导。
class?
代码如下
def test():
pass
test.a = 100
test.b = 200
居然还可以给function赋值? 这个不是之前class的功能吗???
dir(test) 之后发现返回的是一个list
求指导。