Re: Why are so many built-in types inheritable?



Op 2006-03-31, Georg Brandl schreef <g.brandl-nospam@xxxxxxx>:
Antoon Pardon wrote:
Op 2006-03-30, Michele Simionato schreef <michele.simionato@xxxxxxxxx>:
I cannot find the reference now, but I remember Tim Peters saying some
time ago that the only
reason why FunctionType is not subclassable is that nobody bothered to
write a patch for it.

The question then is, why is there a need for such a patch?

I mean when types and classes became unified and ints, lists ... became
subclassable one would think that in all those new code that had to be
written, it wouldn't have been that difficult to see to it that all
types became subclassable. I find it hard to believe that in the
unification period the decision to make one type subclassable and
an other not was made solely on the basis that a patch was submitted
for the first but not for the other.

It's not that hard to understand, is it?

That depends.

Whoever made the builtin types new-
style types didn't add the BASETYPE flag to function or slice. Apparently
he thought it wasn't worth the effort as he couldn't imagine a use case for it.

Well that looks somewhat short sighted to me. It is also why python
seems to throws so many surprises at people.

My impression is that quite frequently people come here with a question
about why something doesn't work, that normally could be expected to
work.

The reason why it doesn't work then seems to boil down to the
developpers not taking the trouble of implementing something
in general but only for the cases for which they could imagine
a use case. Which means that when someone comes up with a use
case later he is stuck.

I know about practicality beating purity, but purity has it
practical aspects too. If the python people had been willing
to work a bit more at purity, that would have been a lot
of more practical for those who found something not working
as expected, although they had no reason to suspect so.

--
Antoon Pardon
.



Relevant Pages

  • Re: Why are so many built-in types inheritable?
    ... Antoon Pardon wrote: ... reason why FunctionType is not subclassable is that nobody bothered to ... why is there a need for such a patch? ...
    (comp.lang.python)
  • Re: Why are so many built-in types inheritable?
    ... reason why FunctionType is not subclassable is that nobody bothered to ... why is there a need for such a patch? ...
    (comp.lang.python)
  • Re: [patch] lockf(3) user-exploitable kernel panic
    ... I know my patch fails ... that libutil tries to provide this interface. ... The reason I asked was because I don't have access to many boxes of ... different architectures or operating systems. ...
    (freebsd-arch)
  • Re: PATCH/RFC: [kdump] fix APIC shutdown sequence
    ... this is correct behavior and it is just specific to level ... Even if my patch in the form in which I submitted it is unusable, ... Or is there any specific reason why the current code does it vice-versa? ... PRIMERGY System Software Engineer ...
    (Linux-Kernel)
  • Re: [PATCH 0/4] add task handling notifier
    ... For some reason neither ever made a lot of progess (performance ... it adds runtime overhead purely for the convenience of kernel ... While I (obviously, since I submitted the patch disagree), ...
    (Linux-Kernel)