Re: Bencoding: How to sort keys for dictionaries ?
Brian Dessent <[email protected]>
| Newsgroups | gmane.network.bit-torrent.general |
|---|---|
| Organization | My own little world... |
| Message-ID | <[email protected]> |
skybuckflying wrote:
> "Keys must be strings and appear in sorted order (sorted as raw
> strings, not alphanumerics)."
It means they're sorted in lexicographical order. This is a frequently
asked question so search the mailing list archives.
> Also why do keys have to be strings.. is that really necessary..
> (since my implementation can easily handle other stuff as well...
> though I haven't tried yet for searching for keys :) I might
> need/make an Equals or so... function for that :) )
The whole concept a dictionary is to associate key and value pairs.
That traditionally means string (scalar) values. I don't see what the
objection is, the only other thing I can think of that would make sense
as a key value is an integer which can be represented just fine as a
string. And yes it is a good idea to require key values to be strings
for consistency.
Brian
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/BitTorrent/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/