[Tutor] Style question with classes and modules

Kent Johnson kent37 at tds.net
Fri Jul 20 00:25:13 CEST 2007


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


More information about the Tutor mailing list