Changeset e25c5e in git for modules/openmathserver/binding.py
- Timestamp:
- Jun 23, 2005, 5:29:01 PM (18 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 87fc8ed722fda44b3c35f66ec2220e0231bfea35
- Parents:
- 057e4d3ca8bf916daba09789459baef304afd8e2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/openmathserver/binding.py
r057e4d3 re25c5e 1 """Definition of the OMBinding object""" 1 2 from objects import OMObjectBase, OMSymbol 2 3 from cd import OMCD … … 8 9 9 10 def islambda(sym): 11 "return True, iff sym is the lambda binder" 10 12 return lambdasym == sym 11 13 12 14 class OMBinding(OMObjectBase): 13 """hopefully fixed possible problems: reevaluation writes new scope, if it isn't 15 """hopefully fixed possible problems: reevaluation writes new scope, 16 if it isn't 14 17 meant so, references do not work correctly because of scopes 15 18 solve this by first evaluation to bounded OMBinding""" … … 21 24 self.bounded = False 22 25 def evaluate(self, context): 26 "evaluate the OMbinding in context" 23 27 assert islambda(self.binder) 24 28 if not self.bounded: … … 30 34 return self 31 35 def bind(self, args): 36 "bind arguments to values" 32 37 #print args, self.variables 33 38 assert len(args) == len(self.variables) … … 35 40 self.scope.push(varBindings) 36 41 def unbind(self): 42 "unbind the arguments" 37 43 self.scope.pop() 38 44 39 45 def calcErg(self, context): 46 "do the actual computation" 40 47 return context.evaluateInScope(self.block, self.scope) 41 48 def __call__(self, context, *args): … … 48 55 XMLtag = "OMBIND" 49 56 def getChildren(self): 57 "get children for (XML) representation" 50 58 return [self.binder]+self.variables+[self.block] 51 def setChildren(self): 52 raise UnsupportedOperationError 53 59
Note: See TracChangeset
for help on using the changeset viewer.