"Phillip J. Eby" <[EMAIL PROTECTED]> wrote on 11/05/2006 17:18:39:
> At 04:27 PM 5/11/2006 +0100, [EMAIL PROTECTED] wrote: > >Why not > > > >class Foo(object): > > @specialize(arg(0)) > > def core.len(self) > > ... > > Where does 'core' come from? What is specialize for? I don't understand > what you're proposing. > Sorry, I didn't make myself very clear. What I was trying to give the impression of was something like C#s explicit interface methods, but without declaring the class implements an interface, and without adding new syntax (i.e defop). I think I meant the same as you really (although the method would appear in the class dict somehow). The core bit is just to show you are overloading the len method, rather than just defining a len method (as I have dropped defop). The specialize bit just tells you what args the multimethod is dispatching on, similar to your x:class bit you mentioned. I know it's not a clear idea at the moment. If I have some time to play, I'll have a think and see if I can make it more concrete. Cheers, Ben > > >I don't know how this would appear in the class dict though? self.len()? > > In my proposal, 'defop' doesn't bind anything; it's just a statement that > defines a function object and then adds that function to the specified > > _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
