[PEAK] Re: Decorators for PyProtocols and PEAK?

Phillip J. Eby pje at telecommunity.com
Sat Jun 26 12:29:54 EDT 2004


At 05:08 PM 6/26/04 +0100, Paul Moore wrote:
>"Phillip J. Eby" <pje at telecommunity.com> writes:
>
> > Couple of interesting questions though...  What order should this sort
> > of advice be applied in?  That is, given:
> >
> >      [x(), y(), z()]
> >
> >      def abc(...):
> >          ...
> >
> > Should x() get first crack at the function, or z()?  Thoughts, anyone?
>
>x first. I believe that this is extremely likely to be the order if
>the syntax gets into 2.4 (I believe it's what the current 2 contender
>patches implement), so it makes sense to follow that. It's also the
>variant that makes most sense to me (which is clearly the crucial
>point :-))

Playing around with this in PEAK, I found that e.g.:

     [binding.Make(uponAssembly=True), events.taskFactory()]
     def some_task(self):
         ...

reads more naturally to me than:

     [events.taskFactory(), binding.Make(uponAssembly=True)]
     def some_task(self):
         ...

That is, I find in practice that 'x(y(z(F)))' order ("context order"?) 
makes more sense than 'z(x(y(F)))' order ("execution order"?).

But until Guido weighs in on the approach, I'm not going to heavily commit 
to a given order, and anything I add to PyProtocols for this should be 
considered experimental where the application order is concerned.  The vast 
majority of decorations in PyProtocols and PEAK are (and will continue to 
be) singular anyhow.




More information about the PEAK mailing list