如何定义python函数,使其类型为;“类型”是什么;?
定义类Foo或函数栏时,我得到:如何定义python函数,使其类型为;“类型”是什么;?,python,class,types,meta,Python,Class,Types,Meta,定义类Foo或函数栏时,我得到: >>> import MethodType >>> type(Foo) classobj >>> type(Bar) function >>> type(MethodType) type 我的问题是,我如何定义一个类/函数,使其类型为“type” 非常感谢。在定义Foo类时,您没有从对象继承: class Foo(object): ... 定义Foo类时,您没有从对象继承: c
>>> import MethodType
>>> type(Foo)
classobj
>>> type(Bar)
function
>>> type(MethodType)
type
我的问题是,我如何定义一个类/函数,使其类型为“type”
非常感谢。在定义
Foo
类时,您没有从对象继承:
class Foo(object):
...
定义Foo
类时,您没有从对象继承:
class Foo(object):
...