-
Notifications
You must be signed in to change notification settings - Fork 47
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
struct.error: bad char in struct format #27
Comments
Hi Eric, you must specify a |
Thanks. Example: |
@farscape2012 you can use BytesDAWG and encode/decode data yourselves. |
Thanks kmike for suggestion.
|
@farscape2012 yes, values should be bytes. The only thing RecordTrie does differently from BytesDAWG is that it converts data to/from bytes using a predefined record format (it uses https://docs.python.org/3/library/struct.html from standard library). With BytesDAWG you need to convert data from/to bytes yourselves. |
Thanks kmike again. Does dawg have a sub/class which supports dictionary value, not only bytes and int? That will make programming far easier. |
@farscape2012 key/value pairs are sorted by their binary value. Internally there are no values - values are just appended to corresponding keys after a separator, and the resulting strings are stored in DAFSA. Storing them in DAFSA makes sense when you think that values can be compressed in a similar way as keys. So e.g. adding an unique integer as a value will make DASFA "explode" almost to a Trie, this is inefficient. If you want to attach arbitrary data to keys then DAFSA is likely a wrong data structure. You may try e.g. https://github.com/pytries/marisa-trie or https://github.com/pytries/hat-trie. With marisa-trie you have an unique ID per key, 0 <= key_id < len(trie); to store arbitrary data just create a Python list of the same length as a Trie and put values at key_id index. HAT-Trie supports Python objects as values natively. |
@kmike Thanks again. Summarizing what you @kmike and @superbobry have suggested, I could proceed in two ways:
Considering scalablity, speed performance, memory efficiency, which method do you guys suggest? Thanks. |
Hi,
I am trying to create a RecordDAWG object which contains tuple that consists of different data type. But there was error.
Does RecordDAWG only accept numeric tuple ?
data = [(u'key1', (1, b'a')), (u'key2', (2, b'b')),(u'key3', (3, b'c'))]
Br,
Eric
The text was updated successfully, but these errors were encountered: