[Python-Dev] Code Generation Idea Was: Bytecode idea (original) (raw)

Fred L. Drake, Jr. fdrake@acm.org
Wed, 26 Feb 2003 11:00:11 -0500


Skip Montanaro writes:

Hmmm... Those code blocks would only be executed on older versions of the interpreter. Is there some way to use that knowledge to finesse the problem? It would be a real hack, but if the compiler recognized precisely the above construct (or at least assignment in an except block guarded by NameError), it could shut up about the assignment.

Another possibility would be that in a module containing no assignments to True and False, references could be converted to special byte codes. Not quite the same, but allows for optimizations at any rate.

-Fred

-- Fred L. Drake, Jr. PythonLabs at Zope Corporation