Contact: fumanchu@aminus.org

Log in as guest/geniusql to create tickets

Changeset 98

Show
Ignore:
Timestamp:
07/23/07 18:28:33
Author:
fumanchu
Message:

New Expression.is_constant method.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/geniusql/logic.py

    r97 r98  
    345345        f = eval(func, builtins) 
    346346        self._load_func(f) 
     347     
     348    def is_constant(self, value): 
     349        """Return True if self.func == (lambda: value), False otherwise.""" 
     350        fc = self.func.func_code 
     351        return fc.co_code == 'd\x01\x00S' and fc.co_consts == (None, value) 
    347352 
    348353 
     
    457462    return expr 
    458463 
    459