Hello,
I'm writing a kind of language simulation. Here, an expression like "a#3.b" maps to a NamedData node, with an attribute terms=[('.','a'),('#',3),('.'''b')]. (The lang uses '#' instead of "[...]" for item indexing.) When this node is "run", the source code maps to a name lookup operation in current scope, passing the terms attr as argument. Below the code with debug prints and the error I get and cannot understand: ================== class Scope(Code): ... @staticmethod def lookup(scope, terms): ''' actual data refered to by name (or context) terms''' data = scope # actually, initial container for term in terms: (sign,key) = term print data, (sign,ATTR,sign==ATTR,sign is ATTR), key if sign == "ATTR": # sign == ATTR='.' print "getAttr" data = data.getAttr(key) else: # sign == ITEM='#' print "getItem" data = data.getItem(key) ####### line 82 ####### return data === output ======= currentScope ('.', '.', True, True) a getItem ... traceback ... File "/home/spir/prog/python/claro/scope.py", line 82, in lookup data = data.getItem(key) AttributeError: 'Scope' object has no attribute 'getItem' ================== (Scopes actually have no getIem, they're plain symbol (attribute) containers.) There must be something such obvious I'm too stupid to see it! What do I overlook? How can it branch to the "getItem" side of the choice? Denis ________________________________ vit esse estrany ☣ spir.wikidot.com _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor