IDEA for super (Re: [Python-Dev] Classes and Metaclasses in Smalltalk) (original) (raw)
Greg Ewing greg@cosc.canterbury.ac.nz
Thu, 03 May 2001 15:39:08 +1200 (NZST)
- Previous message: [Python-Dev] Classes and Metaclasses in Smalltalk
- Next message: IDEA for super (Re: [Python-Dev] Classes and Metaclasses in Smalltalk)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido:
Will we need to add a "::" operator to Python???
If so, I hope we can find a syntax that doesn't remind one of C++ so much...
I have an idea!
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++ :-)
Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
- Previous message: [Python-Dev] Classes and Metaclasses in Smalltalk
- Next message: IDEA for super (Re: [Python-Dev] Classes and Metaclasses in Smalltalk)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]