Using 'apply' as a decorator, to define constants

Leonhard Vogt leonhard.vogt at
Sat Aug 22 10:58:47 CEST 2009

> Why I've personally stopped using it: I've always had the impression
> that decorators were intended to provide a convenient and obvious way
> of augmenting functions. Having one that automatically executes the
> function at definition just runs counter to the behaviour I expect
> from a decorator. Especially when direct assignment... foo = foo
> () a far more direct and clear way of expressing exactly what is
> happening.

if you have to define it yourself, you could call it store_result or
something else instead of apply.

def tags():
     return result


More information about the Python-list mailing list