On Thu, Nov 14, 2013 at 7:32 PM, Victor Stinner <victor.stin...@gmail.com> wrote:
> I would prefer to split the registry of codecs to have 3 registries: > > - "encoding" (a better name can found): encode str=>bytes, decode bytes=>str > - bytes: encode bytes=>bytes, decode bytes=>bytes > - str: encode str=>str, decode str=>str > > And add transform() and untransform() methods to bytes and str types. > In practice, it might be same codecs registry for all codecs just with > a new attribute. I like this idea very much. But to see IIUC, let me be more explicit... you'll have (of course, always py3k-speaking): - bytes.decode() -> str ... here you can only use unicode encodings - no bytes.encode(), like today - bytes.transform() -> bytes ... here you can only use things like zlib, rot13, etc - str.encode() -> bytes ... here you can only use unicode encodings - no str.decode(), like today - str.transform() -> str ... here you can only use things like... like what? When to use decode/encode was always a major pain point for people, so doing this extra separation and cleaning would bring more clarity to when to use what. Thanks! -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ Twitter: @facundobatista _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com