[Checkins] SVN: z3c.pt/trunk/src/z3c/pt/codegen.py Make the code
more readable
Hanno Schlichting
plone at hannosch.info
Sat Aug 2 06:13:10 EDT 2008
Log message for revision 89188:
Make the code more readable
Changed:
U z3c.pt/trunk/src/z3c/pt/codegen.py
-=-
Modified: z3c.pt/trunk/src/z3c/pt/codegen.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/codegen.py 2008-08-02 09:53:11 UTC (rev 89187)
+++ z3c.pt/trunk/src/z3c/pt/codegen.py 2008-08-02 10:13:09 UTC (rev 89188)
@@ -3,15 +3,15 @@
from transformer import ASTTransformer
-marker = object()
CONSTANTS = frozenset(['False', 'True', 'None', 'NotImplemented', 'Ellipsis'])
-
UNDEFINED = object()
+
class Lookup(object):
"""Abstract base class for variable lookup implementations."""
+ @classmethod
def globals(cls):
"""Construct the globals dictionary to use as the execution context for
the expression or suite.
@@ -20,8 +20,6 @@
'_lookup_attr': cls.lookup_attr,
}
- globals = classmethod(globals)
-
@classmethod
def lookup_attr(cls, obj, key):
try:
@@ -50,7 +48,7 @@
return ast.CallFunc(ast.Name('_lookup_attr'), [
self.visit(node.expr), ast.Const(node.attrname)
])
-
+
class Suite(object):
__slots__ = ['code', '_globals']
@@ -73,7 +71,7 @@
self._globals = Lookup.globals()
self.code = gen.getCode()
-
+
def __hash__(self):
return hash(self.code)
More information about the Checkins
mailing list