The type/object distinction and possible synthesis of OOP and imperative programming languages

Rotwang sg552 at hotmail.co.uk
Mon Apr 15 18:54:21 EDT 2013


On 15/04/2013 23:32, Chris Angelico wrote:
> 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?

No idea. I wasn't suggesting that trying to inherit from FunctionType 
was a sensible thing to do; I was merely pointing out that slice's 
status as an internal feature was not IMO relevant to the point that 
Antoon was making.



More information about the Python-list mailing list