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

Mark Janssen dreamingforward at gmail.com
Tue Apr 16 18:38:29 EDT 2013


On Mon, Apr 15, 2013 at 3:32 PM, Chris Angelico <rosuav at gmail.com> 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?

I think his point remains valid, from a theoretical pov.  Python
prides itself on the idea of "first-class functions" and such, but
unlike the world of lambda calculus, this selling point is a bit
invalid.  Because for Python (and any C-based language), it is roots
squarely in the Turing machine and its real-word implementation.

  (Note this contrasts starkly with Java(script), which doesn't seem
to be based on anything -- can anyone clarify where Java actually
comes from?)
-- 
MarkJ
Tacoma, Washington



More information about the Python-list mailing list