Removing [methods from] a superclass?

Justus Pendleton justus at my-deja.com
Tue Feb 1 15:45:28 EST 2000


In article <000a01bf6cd7$a8fcee20$3acbd9c2 at peridot.optichrome.com>,
  "Adrian Eyre" <a.eyre at optichrome.com> wrote:
> GH>> is it possible to _remove_ objects of a superclass?
> GH>> ...I need to remove some methods like .append and .pop.
>
> WW> If the purpose is to simply prevent the user from calling those
> WW> methods, you could overload them with methods that raise
exceptions.
>
> I feel that if you need to do that, there is something wrong with your
> inheritence model.

It's not his inheritance model; he is trying to reuse code, isn't he?
He shouldn't have to rewrite the system libraries to have a system class
inherit from a user defined class.  In his book Framing Software Reuse,
Paul Bassett introduces the notion of "frames", which complement
traditional OO programming.  A frame has the ability to add, *delete*,
select, modify, and iterate the default properties of other frames.
Bassett believes that deletion of properties is integral to successful
reuse in the real world.

Heck, even Eiffel, seemingly language of choice of the Object Gestapo
;-) lets you undefine features (albeit with some restrictions).

> Have a new base class called UserObject which contains all the methods
> shared by UserList and UserString, and subclass from that.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list