2 ms·
> The decorator can do introspection on the function object. so can normal (i.e. not using decorators) code after the the function, e.g.: def myFunction(x)
by cabalamat 16y ago
> The decorator can do introspection on the function object.
so can normal (i.e. not using decorators) code after the the function, e.g.:
def myFunction(x):
blah
doSomethingWith(myFunction)
Here, doSomethingWith() can introspect on myFunction()
- miloshasan 16y agoAh, yes - of course decorators do not fundamentally increase the expressive power of the language (and neither do lambdas, obviously). It's all just a matter of convenience and elegance, which are in the eye of the beholder anyway...