The type/object distinction and possible synthesis of OOP and imperative programming languages
Chris Angelico
rosuav at gmail.com
Mon Apr 15 18:32:45 EDT 2013
On Tue, Apr 16, 2013 at 8:12 AM, Rotwang <sg552 at hotmail.co.uk> wrote:
> Traceback (most recent call last):
> File "<pyshell#2>", line 1, in <module>
> class C(type(lambda: None)):
> TypeError: type 'function' is not an acceptable base type
>
>
> and I don't think that FunctionType would be considered an "internal
> detail", would it? Not that I'd cite the fact that not all types can be
> inherited from as evidence that types and classes are not synonyms, mind.
Actually, I'm not sure how you'd go about inheriting from a function.
Why not just create a bare class, then assign its __call__ to be the
function you're inheriting from?
ChrisA
More information about the Python-list
mailing list