super - is (should) it (be) a reserved word?

jay.krell at cornell.edu jay.krell at cornell.edu
Sat Oct 7 02:55:39 EDT 2000


The better syntax would be not self.__class__.super but self.super, better
yet just plain super, but I guess that more C++ or Javaesque than
Pythonesque. super(self) isn't terrible though.

And is there a static form of this? Like how do I write:

class FileBase:
    def read(self):
        .. read stuff ..

class FileDerived(FileBase):
    def read(self):
        base.read(self)
        .. read more stuff ..

class FileMoreDerived(FileDerived):
    def read(self):
        base.read(self)
        .. read more stuff ..

without sprinkling hardcoded base classes around? If I use
self.__class__.__bases__[0] on a FileMoreDerived in a member function of
FileDerived, I'd get back FileDerived instead of FileBase, right?

I guess "Is there is static form of ..?" in Python is always no?

 - Jay

-----Original Message-----
From: Michal Wallace <sabren at manifestation.com>
To: tgagne at efinnet.com <tgagne at efinnet.com>
Cc: python-list at python.org <python-list at python.org>
Date: Friday, October 06, 2000 11:19 PM
Subject: Re: super - is (should) it (be) a reserved word?


>On Sat, 7 Oct 2000, Thomas Gagne wrote:
>
>
>> I like the idea of 'super' being useful when there's single
>> inheritence, and its behavior being undefined, or even an error,
>> when thee are multiples.
>
>how about a utility function?
>
>def super(object):
>   try:
>       return object.__class__.__bases__[0]
>   else:
>       return None
>
>
>Cheers,
>
>- Michal
>------------------------------------------------------------------------
>www.manifestation.com  www.sabren.com  www.linkwatcher.com  www.zike.net
>------------------------------------------------------------------------
>
>
>--
>http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list