[Python-Dev] Silly little benchmark

Fred L. Drake, Jr. fdrake@acm.org
Tue, 10 Jul 2001 21:44:26 -0400 (EDT)

Skip Montanaro writes:
 > One thing that occurs to me as I rebuild 1.6 is that it would be real nice
 > to be able to query the interpreter for the compilation flags at runtime so
 > I could be more certain I was comparing apples and apples.  In my case, the

Guido van Rossum writes:
 > If you did a full "make install" then and the results are still
 > around, look in <prefix>/lib/python1.6/config/Makefile .

  And this can all be extracted from Python without having to delve
into obscure installed files, as well.  ;-)

For Python 1.6:

    >>> import distutils.sysconfig
    >>> distutils.sysconfig.OPT
    '-g -O2'

For Python 2.0 and newer:

    >>> import distutils.sysconfig
    >>> distutils.sysconfig.get_config_var('OPT')
    '-g -O2 -Wall -Wstrict-prototypes -fPIC'


Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Digital Creations