[RFC] Pyrex implementation for bencode

Martin Pool mbp at sourcefrog.net
Tue Aug 7 08:50:12 BST 2007


On 8/7/07, Aaron Bentley <aaron.bentley at utoronto.ca> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> 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.

You could serialize them as lists, lists, ints, utf-8 strings
respectively, and None depending on the context.  But in a sense that
is contradicting the goal of doing serialization just once, because
the higher-level code would be converting them down and back up.

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?

-- 
Martin



More information about the bazaar mailing list