If it won't be simple, it simply won't be. [Hire me, source code] by Miki Tebeka, CEO, 353Solutions

Tuesday, April 05, 2011

A simpler named decorator

Everybody loves decorators. However there's is a difference if a decorator is called with or without () (as in @logged vs @logged("foo")). In the first case, the logged will be called with the function it decorates. In the second case, logged is called with a string and should return a function that accepts the function to be decorated. Below is a simple solution to support both cases in one decorator.

1 comment:

Anonymous said...

Приветик!
Даже очень забавный сайт.

Море приколов...План, Миксы, Соль, МДМА, и т.д.
Жми на сайт:
[b]
http://xudra.iluvaxav.tk


[/b]

Blog Archive