[Python-checkins] peps: PEP 511: code transformer context

victor.stinner python-checkins at python.org
Fri Feb 12 20:54:24 EST 2016


https://hg.python.org/peps/rev/b9f4c54b17a8
changeset:   6232:b9f4c54b17a8
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Feb 13 02:54:18 2016 +0100
summary:
  PEP 511: code transformer context

files:
  pep-0511.txt |  13 +++++++++++++
  1 files changed, 13 insertions(+), 0 deletions(-)


diff --git a/pep-0511.txt b/pep-0511.txt
--- a/pep-0511.txt
+++ b/pep-0511.txt
@@ -277,6 +277,19 @@
 Parameters:
 
 * *code*: code object
+* *context*: an object with an *optimize* attribute (``int``), the optimization
+  level (0, 1 or 2). The value of the *optimize* attribute comes from the
+  *optimize* parameter of the ``compile()`` function, it is equal to
+  ``sys.flags.optimize`` by default.
+
+Each implementation of Python can add extra attributes to *context*. For
+example, on CPython, *context* will also have the following attribute:
+
+* *interactive* (``bool``): true if in interactive mode
+
+XXX add more flags?
+
+XXX replace flags int with a sub-namespace, or with specific attributes?
 
 The method must return a code object.
 

-- 
Repository URL: https://hg.python.org/peps


More information about the Python-checkins mailing list