Re: More decorator rumination

2005-03-31 Thread Peter Otten
Scott David Daniels wrote: > In particular, I thought about something like: > > @mousexy > def OnRightClick(self, x, y): > ... You could somewhat generalize the idea -- have one argument in the wrapper function provide the arguments missing in the wrapped one. Here is a self-contained example,

Re: More decorator rumination

2005-03-30 Thread Scott David Daniels
Jack Diederich wrote: On Wed, Mar 30, 2005 at 02:48:51PM -0800, Scott David Daniels wrote: In particular, I thought about something like: @mousexy def OnRightClick(self, x, y): ... so all event-responding methods tend to look like: def OnRightClick(self, event): x = event.Get

More decorator rumination

2005-03-30 Thread Scott David Daniels
Over on comp.python.education we were discussing a (generally seen as) misuse of decorators to build the definite integral of a function. On thinking over the definite integral decorator, I had almost decided that one necessary, but not sufficient, criterion for a good decorator is that it must not