hoytak / treedict

TreeDict is a fast, flexible and full-featured hierarchical python container that makes simple and sophisticated bookkeeping easy.
http://www.stat.washington.edu/~hoytak/code/treedict/
Other
30 stars 9 forks source link

"structure freeze" feature? #2

Closed swayf closed 13 years ago

swayf commented 13 years ago

First of all, thank you very much for sharing so great module :) And now the question. Could be possible to implement the possibility to "freeze structure"? For example: t = TreeDict() t.a.b = 10 t.a.c = 20 t.a.freeze('structure') t.a.b = 33 # possible t.a.w = 22 # exception

hoytak commented 13 years ago

Thanks for your interest in my package and your feedback. I can see why that option would be useful, and it turns out it didn't take much effort to add. It's implemented in the latest git changeset. Now, if you call t.freeze(structure_only = True), it locks in all the branches.

Could you pull the latest git changeset and test this out? (Note that you'll need cython to compile it; the c source isn't in the git repo).

swayf commented 13 years ago

Super :) Thank you very much. I've compiled the module and will test it out.