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 py>import AOP in the pythonic future. These decorators could lead to byzantine trees of @. Now, if the decorators st

Re: Interesting decorator use.

2005-02-24 Thread Steven Bethard
Tom Willis wrote: Getting back to your recipe. Through the explanation of how to get parameters in there, I see how it is possible to get a logger in there. Cool. But credit where it's due, the recipe's Scott David Daniels's. =) STeVe -- http://mail.python.org/mailman/listinfo/python-list

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

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: http://www.python.org/peps

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. > > > > d

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 prepostdecorato

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 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 >