【发布时间】:2014-09-02 15:21:57
【问题描述】:
鉴于以下行为:
def a():
pass
type(a)
>> function
如果a 的类型是function,那么function 的type 是什么?
type(function)
>> NameError: name 'function' is not defined
为什么来自a 的type 中的type 是type?
type(type(a))
>> type
最后:如果a是object,为什么不能被继承?
isinstance(a, object)
>> True
class x(a):
pass
TypeError: Error when calling the metaclass bases
function() argument 1 must be code, not str
【问题讨论】:
-
所有这些似乎都是正确的。你期望
type(function)会返回什么?
标签: python function oop python-2.7