Say, I have a code which calls some function millions time from loop and I want the code to be fast:
def outer_function(file):
for line in file:
inne
CPython (the "standard" python implementation) doesn't do this kind of optimization.
Note however that if you are counting the CPU cycles of a function call then probably for your problem CPython is not the correct tool. If you are 100% sure that the algorithm you are going to use is already the best one (this is the most important thing), and that your computation is really CPU bound then options are for example: