[RFC] Pyrex implementation for bencode

Alexander Belchenko bialix at ukr.net
Tue Aug 7 06:36:21 BST 2007

Hash: SHA1

Aaron Bentley пишет:
> Martin Pool wrote:
>> We may not be using bencode enough for this to show up in
>> macrobenchmarks
> Bundle format 4 uses bencode very heavily, so there might be an
> observable difference there.
> But in my experience, bencode is frustratingly limited.  Not enough
> types are supported.  I want to be able to serialize sets, tuples,
> booleans, unicode and None.

Currently tuples is serialized as lists, and booleans as int.
IIUC, you want to deserialize them in the same objects as before
serialization? I think we could extend bencode format,
per example

t...e - for tuples
b...e - for booleans
n - for None
s...e - for sets (but actually there is no big difference with lists,
because I belive we need to store items from lists in alphabetical order,
as dict keys)

I'm not sure how to handle unicode strings.
In tag.py all possible unicode strings manually converted to/from utf-8.
Is this appropriate option to do such conversion automatic? Then

uN:xxxxx - will encode unicode string (as u'xxx' in Python < 3.0)


- --
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the bazaar mailing list