[Python-Dev] Classes and Metaclasses in Smalltalk

M.-A. Lemburg mal@lemburg.com
Wed, 02 May 2001 15:07:27 +0200


Greg Ward wrote:
> 
> On 02 May 2001, Guido van Rossum said:
> > Yes, I can see how to write super() using current tools (or 1.5.2
> > even).  The problem is that this makes super calls even more wordy
> > than they already are!  I can't think of anything that wouldn't
> > require compiler support though.
> 
> I was just doing some gedanken with various ways to spell "super", and I
> think my favourite is the same as Java's (as I remember it):
> 
> class MyClass (BaseClass):
>     def foo (self, arg1, arg2):
>          super.foo(arg1, arg2)
> 
> Since I don't know much about Python's guts, I can't say how
> implementable this is, but I like the spelling.  The semantics would be
> something like this (with adjustments to the reality of Python's guts):
> ...

This doesn't work in Python since Python has multiple inheritence,
e.g. super in 

class A(B,C):
	def foo(self):
		super.foo()

is ambiguous.

I'd rather suggest adding a function for finding the basemethod
of a method. This is probably the most common task in this context.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/