Why is Python so slow ?- revisited.

Shae Erisson shapr at uab.edu
Mon Jun 19 04:41:12 EDT 2000


Mike Fletcher wrote:
> 
> The byte code compilation makes the doc string an attribute of the function
> object, as opposed to a statement that needs to be executed on each
> iteration of the function.

> ...
> 
> The """ syntax would seem to be slower than putting # at the begining of
> everyline because with # it only needs to test the first character of the
> line, if it's # it can skip the rest of the line. But with """, it needs to
> check every character after until it finds the matching """.
> 
> ...

And as Thomas Wouters (I think) pointed out a few days ago, python -OO
gets rid of docstrings in the bytecode, along with other optimizations.
I have no idea if it works in Python 1.2 though.
-- 
sHae mAtijs eRisson (sHae at wEbwitchEs.coM) gEnius fOr hIre



More information about the Python-list mailing list