Re: Interesting decorator use.

2005-02-25 Thread Chris Smith
Tom == Tom Willis [EMAIL PROTECTED] writes: Tom Pretty slick that python can have AOP-like features sort of Tom out of the box. One wonders if there will not be pyimport AOP in the pythonic future. These decorators could lead to byzantine trees of @. Now, if the decorators start writing

Interesting decorator use.

2005-02-24 Thread Scott David Daniels
I have started doing the following to watch for exceptions in wxPython. I'd like any input about (A) the interface, and (B) the frame before I throw it in the recipes book. import wx, os, sys errorframe = None def watcherrors(function): '''function decorator to display

Re: Interesting decorator use.

2005-02-24 Thread Tom Willis
On Thu, 24 Feb 2005 11:15:07 -0800, Scott David Daniels [EMAIL PROTECTED] wrote: I have started doing the following to watch for exceptions in wxPython. I'd like any input about (A) the interface, and (B) the frame before I throw it in the recipes book. import wx, os, sys

Re: Interesting decorator use.

2005-02-24 Thread Steven Bethard
Tom Willis wrote: Question on decorators in general. Can you parameterize those? If I wanted to something and after the function call for example, I would expect something like this would work. def prepostdecorator(function,pre,post): def wrapper(*args,**kwargs): pre() result =

Re: Interesting decorator use.

2005-02-24 Thread Steven Bethard
I wrote: Tom Willis wrote: Question on decorators in general. Can you parameterize those? [snip] If you want to call prepostdecorator with 2 arguments, you need to write it this way. A few options: Sorry, I forgot my favorite one: (4) Use a class and functional.partial: py class

Re: Interesting decorator use.

2005-02-24 Thread Tom Willis
On Thu, 24 Feb 2005 15:00:46 -0700, Steven Bethard [EMAIL PROTECTED] wrote: Tom Willis wrote: Question on decorators in general. Can you parameterize those? If I wanted to something and after the function call for example, I would expect something like this would work. def

Re: Interesting decorator use.

2005-02-24 Thread Steven Bethard
Tom Willis wrote: Question on decorators in general. Can you parameterize those? Wow thanks for the explanation!! Some of it is a bit mind bending to me at the moment , but I'm going to mess with it a bit. Oh, I also should have mentioned that there's some explanation at:

Re: Interesting decorator use.

2005-02-24 Thread Tom Willis
On Thu, 24 Feb 2005 15:20:30 -0700, Steven Bethard [EMAIL PROTECTED] wrote: Tom Willis wrote: Question on decorators in general. Can you parameterize those? Wow thanks for the explanation!! Some of it is a bit mind bending to me at the moment , but I'm going to mess with it a bit. Oh,