Re:Why Python?
by silentbicycle on Saturday October 23, 2010 @08:29AM
(#1823312)
> Macros (and their more hygienic cousins) are not always a good idea. They make it very hard to understand what the rest of the program does, unless you can grep the whole thing.
So does object-oriented programming, more often than not.
I'm not sure that's a sufficient argument, especially if there's no other way to do static metaprogramming in a language.
Though decorators functional identically do just passing a function to another function which returns a function, the decorator syntax is uniquely useful. For framework like Django, it lets you "tag" a function with a single line at the top. I think this greatly enhances readability over the alternative.
Regarding decorators, no they don't seem to be that useful. They do bloat the documentation, if not the language; and you don't ever really need them.