mutux / Ukkonen-s-Suffix-Tree-Algorithm

Ukkonen's suffix tree algorithm, a complete version implemented in Python
http://mutux.com
MIT License
25 stars 10 forks source link

Uses Python 2 syntax #3

Open tripleee opened 6 years ago

tripleee commented 6 years ago

I tried to translate to Python 3 but the meaning of the double parentheses in the setoutedge definition eludes me.

def setoutedge(self, key, (anode, label_start_index, label_end_index, bnode)):

I guessed it would mean

def setoutedge(self, key, anode=None, label_start_index=None, label_end_index=None, bnode=None):

but implementing this change just broke the code in new ways. Could you please explain what this definition means?

HGHARBI commented 5 years ago

I tried to translate to Python 3 but the meaning of the double parentheses in the setoutedge definition eludes me.

def setoutedge(self, key, (anode, label_start_index, label_end_index, bnode)):

I guessed it would mean

def setoutedge(self, key, anode=None, label_start_index=None, label_end_index=None, bnode=None):

but implementing this change just broke the code in new ways. Could you please explain what this definition means?

Use this toolsonlile, it wortks for me https://www.pythonconverter.com/

tripleee commented 5 years ago

I found the following explanation: https://stackoverflow.com/questions/35615939/placing-python-tuples-in-function-signature