Performance impact of using decorators
Steve Holden
steve at holdenweb.com
Fri Mar 10 11:02:22 EST 2006
vinjvinj wrote:
> I'm building an application with cherrypy and have started using
> decorators quite extensively. A lot of my exposed functions look like:
>
> @expose
> @startTransactrionAndBuildPage
> @partOfTabUi(tabId)
> @convert(arg1=int, arg2=str)
> def do_main_page(self, arg1, arg2):
> some code
>
>
> I've become really fond of decorators and use them quite a lot. I've
> also ready that function calls are expensive in python. In the above
> example, does the interpreter call 5 different functions?
>
Without reading your code I can't be sure, but this is sure looking like
the classic "to a man with only a hammer all problems look like a nail"
solution. I'm not going to tell you that decorators aren't the answer to
all programming problems, because you already know that in your heart :-)
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com
More information about the Python-list
mailing list