Avoiding name conflicts in datastructures
Tjstretchalot opened this issue · 10 comments
What are your thoughts on renaming all the Node classes to LinkedListNode, TreeNode, ect so it's less confusing if you're trying to test them out in idle?
@Tjstretchalot How about a node class like nodes.py to import them from
Example:
from pygorithm.data_structures.nodes import LinkedListNode, TreeNode
Or something like
from pygorithm.data_structures.nodes import GenericNode
Personally I prefer either one file per class or one file per algorithm. If you combined the nodes into one file that implies a stronger similarity between nodes of different structures than the similarity between the nodes and their containers, which would be a difficult argument to make
@Tjstretchalot Then I feel we should go for one file per algorithm
@IanDoarn and what about renaming them inside those files (the original question)?
@Tjstretchalot how do you mean?
Right now we have the "Node" class in several locations (though implemented differently). I was wondering if anyone opposed renaming each respective one to something more specific. For example:
https://github.com/OmkarPathak/pygorithm/blob/master/pygorithm/data_structures/linked_list.py#L11
Change that line to def LinkedListNode (and update the other references)
@Tjstretchalot I'm not opposed to it!
Yes I think Node class should be renamed.
I will rename the Node class with respected names in my next commit
Perfect!