Terry Carroll wrote: > On Thu, 19 Jul 2007, Kent Johnson wrote: > >> This is such a common optimization that Raymond Hettinger (the king of >> speed :-) wrote a decorator to do it automatically: > > Some day I'm going to have to figure out decorators.
Well, that particular decorator is hairy, but in general they are not that hard. If you understand the idea of a function that takes a function as an argument and returns another function then you can understand decorators. OK, it also helps if you can understand a function whose return value is a function that takes a function as its argument and returns a function :-) Here is my gentle introduction: http://personalpages.tds.net/~kent37/kk/00001.html Kent _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
