How to write Inline Functions in Python?

Delaney, Timothy tdelaney at avaya.com
Thu Nov 14 01:20:40 EST 2002


> 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