[Python-ideas] Optimizing builtins

Carl M. Johnson cmjohnson.mailinglist at gmail.com
Sun Jan 2 10:46:53 CET 2011


On Sat, Jan 1, 2011 at 11:38 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:

> If this ever happes, -O and -OO will no longer be expressive enough (IMHO,
> -OO currently isn't anyway). There would be a need to support options like
> "-Ostatic-builtins" and the like. The problem then is how to keep users from
> applying a particular optimisation to a particular module. New settings in
> distutils could help to enable optimisations and maybe even to explicitly
> forbid optimisations, but life would certainly become more error prone for
> distributors and users. It's hard to keep track of the amount of bug reports
> and help requests we get from (mostly new) Cython users about a missing
> "-fno-strict-aliasing" when compiled modules don't work in Python 2. I
> expect the same to come up when users start to install Python modules with
> all sorts of great CPython optimisations. Test suites may well fail to catch
> the one bug that an optimisation triggers.

If a flag wouldn't work, what about a pragma? Pragma smell a bit
unpythonic to me, but we did have a pragma for source encoding and
unicode literals in Python 2, so it's not unprecedented. How much
would it solve efficiency-wise if you could just write at the top of a
particular module ##ORIGINAL BUILTINS ONLY PLEASE ? Or is this the
first step on the dark path to Perl 6?

-- Carl Johnson



More information about the Python-ideas mailing list