[Checkins] SVN:	Sandbox/malthe/chameleon.core/src/chameleon/core/clauses.py	Slight optimization.
    Malthe Borch 
    mborch at gmail.com
       
    Mon Nov 17 07:59:58 EST 2008
    
    
  
Log message for revision 93043:
  Slight optimization.
Changed:
  U   Sandbox/malthe/chameleon.core/src/chameleon/core/clauses.py
-=-
Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/clauses.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/clauses.py	2008-11-17 12:37:34 UTC (rev 93042)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/clauses.py	2008-11-17 12:59:58 UTC (rev 93043)
@@ -605,7 +605,14 @@
             stream.outdent()
             
         for attribute, value in dynamic:
-            default = self.defaults.get(attribute)
+            # as an optimization, we only define the `default` symbol,
+            # if it's present in the evaluation value (as string
+            # representation).
+            if stream.symbols.default in str(value):
+                default = self.defaults.get(attribute)
+            else:
+                default = None
+
             if default is not None:
                 stream.write("%s = %s" % (stream.symbols.default, repr(default)))
             
    
    
More information about the Checkins
mailing list