> Neat! From a quick read of the docs, I have a few minor questions: Thanks for the look & the helpful feedback! I appreciate it.
> -- Why invent a new mechanism for global variables > (getTree/treeExists)? It seems redundant (and violates "there's only > one way to do it", if you care about that prescription for pythonicity > ;-) I see what you mean, but there are a couple, possibly weak, reasons why I thought those would be useful. First, my inspiration was the python logging module with its getLogger function that instantiates/returns a logger with that given name, and the resulting logger is common across modules. Second, it always felt a little weird to me to "write" important information to an imported module's namespace without some sort of function that lets you know what you're doing. However, a bit of googling indicates that this is an accepted way of doing things if there's a global config file imported everywhere and all the config parameters are set in that file. Now I'm +0 on keeping them in. > -- I'd prefer PEP8-complaint method names, e.g. branch_name rather > than branchName. Ah... I was not familiar with that PEP, but it makes sense. I chose to do it this way since I usually have variable names in that style, which become attributes with TreeDict, and wanted to avoid conflicts. However, I think a PEP would overrule that. Since I'm currently the only one using it, I can change over to that. > -- What advantage do you get from using cython instead of regular > python? I guess the edit distance calculation for similarity matching > is CPU-bound, but I wouldn't expect even that to be a bottleneck in > regular usage. I admit it is possible that I over-designed it, but I felt like there is enough to check that would be much faster with C than in Python. For example, analogously to dict, iteration locks all the branches affected by the iteration such that setting a value when an iterator is active raises an exception. Thus when setting a value on a branch, I need to walk from that branch all the way to the root checking for such a flag. In python, this could require a number of (fast) lookups; however, with my cython code the entire check process is C code. There's similar checks required for frozen trees, updating, etc. Since I wanted this data structure to be fast enough to use in inner loops (the attribute-style syntax suggests such a use), I thought cython would be a better choice. --Hoyt ++++++++++++++++++++++++++++++++++++++++++++++++ + Hoyt Koepke + University of Washington Department of Statistics + http://www.stat.washington.edu/~hoytak/ + [email protected] ++++++++++++++++++++++++++++++++++++++++++ _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
