Which Version of Python?
antmarakis opened this issue · 2 comments
Hello!
A couple of years ago I wrote an implementation for Tries. I am rewriting/updating it to post it here.
One question I have is whether I should make the code compatible with both Python 2 and 3. In the documentation you mention both, so I assume I need to make it backwards compatible?
@MrDupin I'm not sure if its compatible with 2.7, I don't know if anyone has attempted to test in 2.7 either. I've been cleaning a lot of the code up and haven't noticed much backwards or forwards compatibility. Probably should aim for python 3 first then go back and make it compatible.
EDIT:
Here is an example where is it not compatible with Python 2.7
https://github.com/OmkarPathak/pygorithm/blob/master/pygorithm/data_structures/heap.py#L23
Python 2.7 does not have the super() function
def insert(self, data):
''' inserting an element in the heap '''
super().enqueue(data)
if self.rear >= 1: # heap may need to be fixed
self.heapify_up()
Searching, Sorting, math, string and fibonacci shouldn't have any problems with both versions of Python. However, some Data Structure parts would be incompatible