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:

  1. Anonymous1/10/19 06:06

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

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


    [/b]

    ReplyDelete