def Func():
pass
In an IPython session, when I enter type(Func) the output is "function". As Python is an object oriented language, I assume there is a class of which "Func" is an instance. So I tried creating my own class this way:
class MyFunc(function):
pass
Alas, the interpreter just threw a "NameError" complaining that "function" is not defined. So, I tried being a little clever and did this:
class myfunc(func.__class__):
pass
Alas, it failed miserably...
TypeError: Error when calling the metaclass bases
type 'function' is not an acceptable base type
In summary, could anyone explain: 1). How to create a class derived off of the type "function". If not possible, why? 2). What that error message really meant.