[Python-ideas] __before__ and __after__ attributes for functions

Paul Moore p.f.moore at gmail.com
Thu Jan 23 10:08:32 CET 2014


On 23 January 2014 08:57, Nick Coghlan <ncoghlan at gmail.com> wrote:
> The main problem with the idea of doing this as a more general feature for
> arbitrary callables is that it has most of the same downsides as
> monkey-patching while being strictly less powerful and even more confusing
> (since it would be difficult to model clearly in tracebacks).

Also, this would add overhead to all function calls (even if no
before/after functions exist, checking the lists has a small cost) and
function call overhead is already higher than many people would like.

Paul


More information about the Python-ideas mailing list