On Jun 21, 2010, at 03:29 PM, Toshio Kuratomi wrote:

>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).

Doing this at ebyte construction time does have the nice benefit of getting
the exception early, and because the ebyte is unmutable, you could cache the
results in an attribute on the ebyte.  Well, unmutable if the .encoding is
also unmutable.  If that can change, then you'd have to re-run the cached
decoding whenever the attribute were set, and there would be a penalty paid
each time this was done.

That, plus the socket use case, does argue for a separate ebytes type.

-Barry

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to