[Python-Dev] Add transform() and untranform() methods

Nick Coghlan ncoghlan at gmail.com
Sat Nov 16 13:48:06 CET 2013


On 16 November 2013 21:38, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 16 November 2013 20:45, Victor Stinner <victor.stinner at gmail.com> wrote:
>> Why not using str type for str and str subtypes, and bytes type for bytes
>> and bytes-like object (bytearray, memoryview)? I don't think that we need an
>> ABC here.
>
> We'd only need an ABC if info was added for supported input types.
> However, that's not necessary since "encodes_to" and "decodes_to"  are
> enough to identify Unicode encodings: "encodes_to in (None, bytes) and
> decodes_to in (None, str)", so we don't need to track input type
> support at all if the main question we want to answer is "is this a
> Unicode codec or not?".

I realised I misunderstood your proposal because of the field names
you initially suggested. I've now proposed a variation with different
field names (encodes_to instead of output_type and decodes_to instead
of input_type) and a "codecs.is_text_encoding" query function
(http://bugs.python.org/issue19619?#msg203037)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list