Hello all, I downloaded some code accompanying the book "Programming the Semantic Web." This question is not Semantic Web related and I doubt that one needs to know anything about the Semantic Web to help me with this. It's the first code sample in the book, I'm embarrassed to say. I have the code shared here (just one file, not the majority of the book or anything): http://pastebin.com/e870vjYK
OK, Eclipse with PyDev doesn't like this first line, with the function: def add(self, (sub, pred, obj)): It complains about the parentheses just before sub. Simply removing them just moves me down to another error. I did try using python 3.x (3.4 to be specific), which meant changing print statements to function calls. Of course, that didn't fix the errors I was mentioning. The text uses python 2.7.x. There are other places where I thought that there were too many parentheses and I tried removing one set of them. For example this snippet here: def remove(self, (sub, pred, obj)): """ Remove a triple pattern from the graph. """ triples = list(self.triples((sub, pred, obj))) Are the two sets parentheses needed after self.triples? That syntax is confusing to me. It seems that it should be triples = list(self.triples(sub, pred, obj)) The full listing is here: http://pastebin.com/e870vjYK I agree with the authors that python is a fun and easy language to use, thus it is strange that I am getting stuck here. Thanks, Bruce -- https://mail.python.org/mailman/listinfo/python-list