Closed SleepProgger closed 8 years ago
If we are to ship this we need to implement all the methods from https://docs.python.org/3/library/stdtypes.html#mapping-types-dict
Should be compatible with py2 and py3. For example, in py3 .values()
returns a list
, while in py3 you get a iterator. To get a iterator in py2 you need .itervalues()
. It would be nice adhere to that API.
All that with the order/duplicates in mind, of course. At a glance it seems that it might not be the case currently.
May as well consider calling it VDFDict
or something else as it's specific to VDF, rather than a generic solution. For example, one of the underline assumptions is that keys can only be a str
or tuple
.
Finally, might as well throw the code for it in a separate file as this is __init__
is getting long.
I refactored the code a bit. It should now be compatible with py2 and 3. Also moved the class to its own file. Let me know what you think.
edit: We should def squash my fail series if you accept this pull request. (Sorry for the mess)
Hi, I've pulled your code and reworked it. See #8
I added your DuplicateOrderedDict implementation as referenced in #5 , and some test cases. Also, i made the usage feel a bit more like a "real" dict.
If you don't like my changes please tell me what to change. IMHO, the vdf lib really need something like this build in asap.