[RFC] Pyrex implementation for bencode

Alexander Belchenko bialix at ukr.net
Tue Aug 7 16:47:54 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley пишет:
> 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.)

Oh, man! It's like you always can transparently encode unicode strings
if they contains only chars with codes below 128? ;-)
I think we need to name our extended version as bencode-ext or bzr-bencode
(as opposite to BitTorrent-bencode package on PyPI) and simply go on.

[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGuJQqzYr338mxwCURAnKfAJ9QmVGubjThxgMJ0cef4XbHvqIGVwCfQ3LX
de3VTTgirgOaExFjc/ivQd8=
=Qxs0
-----END PGP SIGNATURE-----



More information about the bazaar mailing list