IDEA for super (Re: [Python-Dev] Classes and Metaclasses in Smalltalk)
Peter Funk
pf@artcom-gmbh.de
Thu, 3 May 2001 08:29:03 +0200 (MEST)
Hi,
Greg Ewing:
[...]
> How about spelling super(self, MyBaseClass) as
>
> MyBaseClass[self]
>
> This can be thought of as a sort of "cast" which turns self
> into an object which behaves like it were an instance of
> MyBaseClass. Then we can write
>
> MyBaseClass[self].foo(args)
>
> Advantages:
> * Concise and uncluttered
> * No new syntax needed
> * Can be implemented using existing mechanisms
> * Doesn't even remotely resemble anything in C++ :-)
Disadvantages:
* People will confuse this with calling MyBaseClass.__getitem__(....)
* Doesn't even remotely resemble anything in C++
We have to face it: I myself don't like C++ either, but a *lot*
of people today are already familar with C++ today. Giving them
something they are already familar with, will make it easier to
convert some of them to Python.
To Greg: This '::' operator is not at all that ugly and AFAI can see
would not introduce any backward incompatible change to the language.
I'm sure C++ has some other real warts to offer that we both don't
want to see in a future version of Python. Right?
Regards, Peter
--
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260
office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen, Germany)