[RFC] Pyrex implementation for bencode

Aaron Bentley aaron.bentley at utoronto.ca
Tue Aug 7 15:54:51 BST 2007

Hash: SHA1

Martin Pool wrote:
> On 8/7/07, Aaron Bentley <aaron.bentley at utoronto.ca> wrote:
>> 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.
> You could serialize them as lists, lists, ints, utf-8 strings
> respectively, and None depending on the context.

Yes, and I certainly have done.

> We could extend it as Alexander says but... can you tell me more about
> where this is frustrating?  Is it just the extra code needed to
> translate them to and from the in-memory format?

Yes.  It seems like redundant work that a generic serializer can easily
handle.  The high-level code shouldn't have to worry about serialization
details like this.

The python bencode implementation is easy to extend, but that would mean
that we could accidentally emit extended-bencoding when we intend to
emit vanilla bencoding.  (It would still be possible to emit vanilla
bencode, but if it encounterd a type not supported by vanilla bencode,
it would silently emit extended-bencode rather than failing.)


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


More information about the bazaar mailing list