They have new syntax to declaring them, the asterik. I don't completely get it, so what I do:
UpdateFun,dict(target=self,offset=self.count)
Then the called function just selects the arguments with:
def UpdateFun(n,id,x) : # Stop when x=y
if n == x['target'] :
print("found ",id,n.value,n.count)
n.return_val = DONE
else : n.count = n.count + x['offset']
return(n.return_val)
It works. But I don't get the part about quoting keywords. They are keywords, they should not be quoted by definition of the term keyword, it means,"No quoting necessary". But, since the keywords are not known to be keywords until the dictionary is opened and peeked at, the operation seems correct. What I am doing does not match their semantics, I am likely doing this inefficiently.
If there was a method, we want the interpreter to check the token against the normal dictionary, it cannot find it. It has to stop looking, dict has no way to indicate that another dict is in the variable list. Dict should be a bit smarter on setting itself up.
I mean, when I print out the dictionary that is implicit,the one execuses, all the keywords are quoted, like a local dictionary,they work the same, fine. Then an unquoted, x, which is in implicit dict, works fine. But the explicit local dict, needs 'x'.
Lets change the definition of dictionary. If should mean list of keywords that is linked to the key word dictionary in the local context.
No comments:
Post a Comment