How to write Inline Functions in Python?

Arivazhagan arivu at qmaxtest.com
Thu Nov 14 09:42:16 EST 2002


Hi Tim

I assume you're coming from C++. - Thats true.

Hi
 
My requirements here.

we have three python files names a.py, b.py and c.py. 
In a.py we are calling a global function in c.py which creates objects
of a class in c.py depending on the parameters passed. These objects
are created in the scope of c.py. But i need to happen in a.py without
using the module name.
so I thought that if we inline the function call so that it expands we
can access that object without referring to the module name.

Is it possible? Is there some other methods to achieve this in python?

regards
b.arivazhagan


"Delaney, Timothy" <tdelaney at avaya.com> wrote in message news:<mailman.1037254879.20737.python-list at python.org>...
> > From: arivu at qmaxtest.com [mailto:arivu at qmaxtest.com]
>  
> > Can any one please explain how to write a Inline Function in Python?
> 
> No. See below.
> 
> > Is Inline Functions available in python?
> 
> No.
> 
> I assume you're coming from C++. In that case, I suggest you take a good
> hard look at why you want to write inline functions/methods anyway. If
> you're doing it for performance reasons, your compiler is almost certainly
> going to be better at deciding what to inline, and has the option to do so
> unless you explicitly tell it not to. If you're doing for any other reason
> (such as putting code in header files) I strongly advise against it.
> 
> Inline was developed when computers were slower and compilers were more
> stupid. These days I see no need to inline whatsoever.
> 
> Tim Delaney



More information about the Python-list mailing list