-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Apr 9, 2009, at 1:15 AM, Antoine Pitrou wrote:
Guido van Rossum <guido <at> python.org> writes: >
I'm kind of surprised that a serialization
protocol like JSON
It's not hard, it just means a lot of duplicated code if the library
wants to support both str and bytes in an optimized way as Martin alluded to.
This duplicated code already exists in the C parts to support the 2.x
semantics of accepting unicode objects as well as str, but not in the Python
parts, which explains why the bytes support is broken in py3k - in 2.x, the same
Python code can be used for str and unicode.
This is an interesting question, and something I'm struggling with for
the email package for 3.x. It turns out to be pretty convenient to
have both a bytes and a string API, both for input and output, but I
think email really wants to be represented internally as bytes.
Maybe. Or maybe just for content bodies and not headers, or maybe
both. Anyway, aside from that decision, I haven't come up with an
elegant way to allow /output/ in both bytes and strings (input is I
think theoretically easier by sniffing the arguments).
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin)
iQCVAwUBSd3Vf3EjvBPtnXfVAQKyNgQApNmI5hh9heTYynyADYaDkP8wzZFXUpgg cKYL741MbLpOFn3IFGAGaRWBQe4Dt8i4CiIEIbg3X7QZqwQJjoTtFwxsJKmXFd1M JR0oCB8Du2kE5YzD+avrEp+d8zwl2goxvzD9dJwziBav5V98w7PMiZc3sApklQFD gNYzbHEOfv4= =tjGr -----END PGP SIGNATURE-----