New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support to_data\from_data for DictInterval #51
Conversation
I suppose to "serialize" DictIntevals to the list of 2-tuples `( (left, lower, upper,right), item )`.
I think I have to add some tests here. |
Thanks for your PR! I will have a look asap and provide some feedback :) |
First of all, thank you for your contribution. I see that the purpose of this PR is to provide an "easy way" to import and export However, I don't really understand why this would be part of the library given that one can, quite easily, re-use the fundamentals provided by the library to do so (for instance, I would expect an Thank you! ;-) |
I using your library in my current project to handle time and datetime intervals of some events in Django application. Yes, you are right. I submit a stupid non working code, it was my fault. |
It's not stupid at all ;-) I was mainly wondering whether this should be part of the library or not. |
As far we have a to_data/from_data for simple Intervals I think there should be dict_to_data. Just for unification. But this is your library and your decision. |
Indeed, but the reason why we have from_data/to_data is simply because there is no easy alternative to offer a similar service than having these functions. What I mean is that an IntervalDict can be exported and imported the same way than any other dict in Python. The only "issue" would be to convert the keys (that are Interval objects) to something serializable, and that can be easily done with from_data/to_data. The changes you made for 1674b17 show that it is easy to write such import/export without having to rely on some internals, that's why I'm hesitating to merge this PR. |
We have discussed a lot on whether we should bring this functionality to Thanks again for this PR, I'm sorry for its fate. |
I suppose to "serialize" DictIntevals to the list of 2-tuples
( (left, lower, upper,right), item )
.