I agree, if we're at that point where inlining functions really matters, it's time to consider using modules in C or another very high performance approach. To be honest, in my whole carreer, I've never been in a situation where it made sense to sacrifice readability for performance - everytime I've needed such a high performance, the (succesful) approach was to use high-performance alternatives to plain CPython (or to the plain language when I worked with other languages) -.
Most of the time, in my experience, that people tend to make such "code optimizations" (that end up sacrificing readability) they are just shooting in the wrong direction; Such situations include:
- Bad SQL queries;
- Unnecessary I/O (disk, network) trips;
- Naturally slow I/O (like consuming a slow webservice, or one with high latency)
- Bad algorithmn (like +Michael Foord
mentioned, regarding big O)
and none of these are because of additional function/method calls.
Do you need blazing-fast Python? Try PyPy, Cython, or rewriting bits in C, but don't sacrifice readability.