ValvePython / vdf

📜 Package for working with Valve's text and binary KeyValue format
https://pypi.org/project/vdf/
MIT License
167 stars 31 forks source link

Fixed bug with duplicate dictionary keys #5

Closed SleepProgger closed 8 years ago

SleepProgger commented 8 years ago

With a dictionary implementation which allows duplicate keys like this one data in the form of:

{
  7: {1:2},
  7: {2:3},
}

could result in something like:

{
  7: {
    1:2,
    2:3
  }
}

Testdata here

This specific behavior is bound to that specific DuplicateDict implementation, but almost all implementations would have similar problems.


Generally IMHO the default mapper should be some DuplicateDict impl. I mean if duplicate keys are allowed in this protocol shouldn't the default setting of this lib be to support this ?

rossengeorgiev commented 8 years ago

Nice spot, and no I think the default should be a native type. It is probably a good idea to ship duplicate dict implementation.