4 ms·
Because the library can "advice" an existing function without decorating that function. # Write a function >>> def there(): ... print "there",
by olejorgenb 3y ago
Because the library can "advice" an existing function without decorating that function.
# Write a function
>>> def there():
... print "there",
...
>>> there()
there
# Write a peice of 'before advice' to run before the function
# New advice is activated by default
>>> @pydvice.before(there)
... def hello():
... print "Hello",
...
# Note that active advice runs automatically on any function call
>>> there()
Hello there