Yielding will return the name of the advised attribute, and its dict value
Returns: (name, dict_value)
Do not use this to call the actual function, you should use proceed for that.
Yielding this, will return the instance to which the advice was applied.
Note that if the advised is a static/class method, this will return the class that has that method.
Yielding arguments, will return (args, kwargs).
Args is a tuple and kwargs a frozendict.
Note: even though get, set, delete advice would never have kwargs; it is always provided. This allows you to share the same bit of advice among multiple types of advice, and also be able to use the self param (the first arg to args, for any type of advice)
Call advised attribute with given args when yielded.
Don’t forget to include a self argument, if needed.
Its return is sent back to the advice.
Return last return value
If yield return_ is used, the return of the last yield proceed is used. If given an argument, that is used as return value.
Yielding this allows suppressing the current aspect temporarily
The yield returns a context manager. While entered, it will suppress the current aspect for the current object (as returned by yield obj). Once the context is exited, the aspect is unsuppressed.
While suppressed, an aspect’s advice does no longer affect the object for which it is suppressed. (it’s the same as disabling an aspect with the difference that suppressing, unsuppressing won’t affect your aspect’s enabled state)