Decorator Base Class: Needs improvement.

Ron_Adam radam2 at tampabay.rr.com
Wed Apr 6 17:19:39 EDT 2005


>I find I am still left asking the question "why would anyone want to do 
>that?".


You didn't say which part you were referring too. As far as wrapping
the same exact wrapper more than once. You probably wouldn't do that.
It's just easier to test the use of multiple wrappers that way.

As far as reversing the stack of wrappers, that could matter. Because
the wrappers are nested, the inputs are done in forward order, and the
results are sent back out in reverse order. If you are applying
several different graphic filters to an image display function, the
order makes a difference, so depending on weather you are modifying
the input values, or the returned values, you may need to reverse the
wrappers before applying them.

>The difference between a use case and an example is that a use case 
>should demonstrate the solution of a problem that someone might 
>reasonably be wanting to solve, rather than a way of creating an 
>abstract program structure for which there is no easily observable 
>requirement.

It was an example that demonstrates a basic capabilities of an
alternative approach, but it is also one solution to certain
sub-problems, simpler function wrapping, and adding and removing
wrappers at locations other than the function definitions.  It's
probably not a new approach either.

>I can understand it if you are merely pursuing this topic because of 
>your fascination with the capabilities of Python, but I don't have the 
>feeling that there are legion Python programmers out there waiting 
>impatiently to be able to build wrapped functions.

Yes, I am pursuing the topic because I enjoy experimenting, and
because I enjoy programming with Python, and I have an interest in
using it in solving real problems.  So the answer is all of the above.
;-)

Cheers,
Ron




More information about the Python-list mailing list