Python performance

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Mar 8 20:34:38 EST 2000


Don Tuttle wrote:
> 
> So how can you tell when your source code will run as compiled C or "run in
> the bytecode engine"?

I think what he means is that if you can write your
program so that it does most of its work by calling
built-in functions, most of the work will get done
at compiled-code speed, because the built-in functions
are written in C.

You can find out whether a given function is built-in
by printing it, e.g.

>>> import string
>>> string.split
<built-in function split>
>>> 
>>> def foo():
...  print "blarg"
... 
>>> print foo
<function foo at 116ad0>
>>> 

-- 
Greg Ewing, Computer Science Dept,
+--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-list mailing list