Re: Why are so many built-in types inheritable?
- From: Antoon Pardon <apardon@xxxxxxxxxxxxxxx>
- Date: 31 Mar 2006 08:41:48 GMT
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
.
- Follow-Ups:
- Re: Why are so many built-in types inheritable?
- From: Georg Brandl
- Re: Why are so many built-in types inheritable?
- References:
- Why are so many built-in types inheritable?
- From: Fabiano Sidler
- Re: Why are so many built-in types inheritable?
- From: Michele Simionato
- Re: Why are so many built-in types inheritable?
- From: Antoon Pardon
- Re: Why are so many built-in types inheritable?
- From: Georg Brandl
- Why are so many built-in types inheritable?
- Prev by Date: Re: Best IDE for Python?
- Next by Date: Re: Best IDE for Python?
- Previous by thread: Re: Why are so many built-in types inheritable?
- Next by thread: Re: Why are so many built-in types inheritable?
- Index(es):
Relevant Pages
|