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.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to