[RFC] Pyrex implementation for bencode
Aaron Bentley
aaron.bentley at utoronto.ca
Tue Aug 7 15:54:51 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
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.)
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGuIe70F+nu1YWqI0RAo0JAJoD7B86vn0pVfk8hS6+Wet4A82GDQCfQHFB
SE6yrEO7fCJ1035g8p4E2So=
=RSD6
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list