I am not really a python person, but having to deal with it just because a book author published their code examples in python. I get a syntax error for below code:
class SimpleGraph:
def __init__(self):
self._spo = {}
self._pos = {}
self._osp = {}
def add(self, (sub, pred, obj)):
"""
Adds a triple to the graph.
"""
self._addToIndex(self._spo, sub, pred, obj)
self._addToIndex(self._pos, pred, obj, sub)
self._addToIndex(self._osp, obj, sub, pred)
...
...
error: def add(self, (sub, pred, obj)): ^ SyntaxError: invalid syntax
Is this a python version issue or something? I can't seem to be able to pass a tuple into a class method in that raw form. Suggestions appreciated. BTW fyi I just downloaded the Python 3.3 compiler.