inline function call

Diez B. Roggisch deets at nospam.web.de
Wed Jan 4 10:06:40 EST 2006


Riko Wichmann wrote:
> Can I call a function in python inline, so that the python byte compiler
> does actually call the function, but sort of inserts it where the inline
> call is made? Therefore avoiding the function all overhead.

No. That is simply impossible in python as well as in java where functions
are always virtual, meaning they are looked up at runtime. Because you'd
never know _which_ code to insert of all the different foo()-methods that
might be around there.

Do you have an actual use-case for that? I mean, do you have code that runs
slow, but with inlined code embarrassingly faster?

Regards,

Diez



More information about the Python-list mailing list