Inheriting from object

John Roth newsgroups at jhrothjr.com
Sat Jul 2 21:56:39 EDT 2005


"Bengt Richter" <bokr at oz.net> wrote in message 
news:42c69a4f.336127175 at news.oz.net...

> I wonder if the above common use of super could be implemented as a 
> property of object,
> so you'd normally inherit it and be able to write
>    self.super.__init__(*args, **kwargs)  # (maybe spell it 
> self.__super__.__init__(...) I suppose)
>
> I.e., self.__super__ would effectively return the equivalent of
>    super(type(self), self)

Well, let's look at it. If I implemented a super() method on
object (and I didn't shadow it anywhere) what I'd have when
it was invoked is something like

def super(self):
    stuff

>From there one could get the current instance's class, so
we've got all the ingredients of the regular super(class, instance)
built-in function. What it wouldn't have is the ability to invoke it
on an arbitrary class and instance.

The big issue seems to be the direction Guido wants to take
Python - he seems to not want to put methods on the
object type. I have to say that I don't understand his reasoning,
if that is indeed his position.

John Roth

>
> Regards,
> Bengt Richter 




More information about the Python-list mailing list