Closed Taco-W closed 7 years ago
Hmm, take back my comments. It is impossible to count how many times a function is called upon package loading time. Then, how about an alternative solution. Can we have a switch in the environment like a DEBUG flag that once turned on, it will decide function dynamically? Then we can count the usage at that time. It will become slower, but will only be used for debugging.
a quite reasonable advice. I'll of course add the DEBUG flag thing!
@jermainewang please check
Can we do it during package loading time? To reduce the call overhead, current package will decide which function to use upon the package is loading. Wrapping
__getattribute__
will add another indirect call for every function calls in minpy.