Can't extend function type
Paul Rubin
http
Fri Oct 7 03:35:16 EDT 2005
Oh well. I had wanted to be able to define two functions f and g, and
have f*g be the composition of f and g.
>>> func_type = type(lambda: None)
>>> class composable_function(func_type):
... def __mult__(f,g):
... def c(*args, **kw):
... return f(g(*args, **kw))
... return c
...
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: Error when calling the metaclass bases
type 'function' is not an acceptable base type
>>>
Seems like a wart to me.
More information about the Python-list
mailing list