[Python-Dev] Cuddly constants seek loving, stable home

Tim Peters tim.one@home.com
Thu, 23 Aug 2001 00:06:28 -0400

__future__.py now contains this abomination:

    import new as _new  # for CO_xxx symbols
except ImportError: # May happen during build
    class _new:
        CO_NESTED = 0x0010
        CO_GENERATOR_ALLOWED = 0x1000
        CO_FUTURE_DIVISION = 0x2000

"new" turned out to be a bad module to hold these constants, despite that
that's where they belong (i.e., along with the function that creates new
code objects), first because "new" wasn't always built "in time" on Unixy
boxes, and second because "new" isn't available at all in restricted mode.

So they can't live in "new", but duplicating their values by hand is also
unbearable.  "sys" is the only other module I see where they *might* fit,
but they don't really belong there (indeed, trying to make a case that they
do is a lot like arguing "len" should be a method <wink>).

So I propose a new builtin module, _sysconsts.  The underscore is to
announce its obscure internal nature.  I propose only to expose the CO_xxx
#defines at the start, but of course others could be added.

Any objections?

ain't-worth-a-pep-unless-there-are-ly y'rs  - tim