RE: [Python-Dev] Improved super/autosuper

guido@python.org wrote:
Hmm - thought I'd seen it in various conversations online (as opposed to in the intro doc). Oh well ...
Yeah - it's somewhat hairy at the moment. I'd like to simplify it further (it's better than it was ...). I came across a number of edge cases while implementing this that are dealt with. I definitely can't claim that I'm 100% sure that it does the right thing - haven't developed a full test suite for it yet (obviously) - this was something I've done in a couple of hours of "spare time" in the last couple of days. Mainly I wanted to get it out to the wider community to see if it was worthwhile pursuing further - and for other people to pick apart and criticise.
Yeah - I meant to mention that (I did in the Cookbook). Yes, it uses sys.getframe() :(
No new keywords, doesn't impinge on the existing use of super. If it's implemented correctly (yet to be proven ;) existing uses of super and this can be used side-by-side, even in the same method.
That would be preferable. Although I do like having super be a property on the instance - it makes method calls on super consistent with everything else. I'd see this as a property on `object` in that case. Initially I wasn't passing self, but just finding it from the stack frame. I'd actually gone away from that approach though before I remembered that wouldn't work with psyco anyway :)
The more I think about it, the more it should be that the default should be to throw exceptions. The rationale behind not throwing attribute exceptions is primarily mix-in classes - they can't know where in the MRO they're going to be - whether or not their attributes are going to interfere with other classes in the MRO. However, the more I think about it, the less examples I can think of where it would be a good thing to do.
OK - super raises. super_raise goes away, and there is no equivalent for not raising. If people want that, they can subclass :) Thanks for the comments Guido. I think I'll let it soak for a while and see what other people think about it. Tim Delaney
participants (1)
-
Delaney, Timothy C (Timothy)