inline function call
Steven D'Aprano
steve at REMOVETHIScyber.com.au
Wed Jan 4 16:47:37 EST 2006
On Wed, 04 Jan 2006 13:18:32 +0100, Riko Wichmann wrote:
> hi everyone,
>
> I'm googeling since some time, but can't find an answer - maybe because
> the answer is 'No!'.
>
> 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.
The closest thing to that is the following:
# original version:
for i in xrange(100000):
myObject.something.foo() # three name space lookups every loop
# inline version:
# original version:
foo = myObject.something.foo
for i in xrange(100000):
foo() # one name space lookup every loop
--
Steven.
More information about the Python-list
mailing list