[Python-Dev] email package status in 3.X (original) (raw)

Toshio Kuratomi a.badger at gmail.com
Mon Jun 21 21:29:52 CEST 2010


On Mon, Jun 21, 2010 at 01:24:10PM -0400, P.J. Eby wrote:

At 12:34 PM 6/21/2010 -0400, Toshio Kuratomi wrote: >What do you think of making the encoding attribute a mandatory part of >creating an ebyte object? (ex: eb = ebytes(b, 'euc-jp')).

As long as the coercion rules force str+ebytes (or str % ebytes, ebytes % str, etc.) to result in another ebytes (and fail if the str can't be encoded in the ebytes' encoding), I'm personally fine with it, although I really like the idea of tacking the encoding to bytes objects in the first place. I wouldn't like this. It brings us back to the python2 problem where sometimes you pass an ebyte into a function and it works and other times you pass an ebyte into the function and it issues a traceback. The coercion must end up with a str and no traceback (this assumes that we've checked that the ebyte and the encoding "match" when we create the ebyte).

If you want bytes out the other end, you should either have a different function or explicitly transform the output from str to bytes.

So, what's the advantage of using ebytes instead of bytes?

-Toshio -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: <http://mail.python.org/pipermail/python-dev/attachments/20100621/af563fdc/attachment.pgp>



More information about the Python-Dev mailing list