[Python-Dev] Add transform() and untranform() methods
tjreedy at udel.edu
Fri Nov 15 02:35:29 CET 2013
On 11/14/2013 6:03 PM, Nick Coghlan wrote:
> You have to get it out of your head that codecs are just about text and
> and binary data.
99+% of the current codec module doc leads one to that impression. The
fact that codecs are expected to have a file reader and writer and that
the default 'strict' error handler is specified in 2 out of the 3 mostly
redundant lists as raising a UnicodeError reinforces the impression.
> They're not: they're arbitrary type transforms, and MAL
> deliberately wrote the module that way.
Generic functions are quite pythonic. However, I am not sure how much
benefit there is to registering an arbitrary pair of bijective functions
> This is completely the wrong approach. There's zero justification for
> adding new builtin methods for this use case - encoding and decoding are
> generic operations, they should use functions not methods.
Making 2&3 code easier is certainly a good reason for the codecs approach.
> The next planned commit (to restore the binary codec aliases) *is* a
> behavioural change - that's why I posted to the list about it (it
> received only two responses, both +1)
If I understand correctly, I am mildly +1, but did not respond, thinking
that 2 to 0 was sufficient response for you to continue ;-).
Terry Jan Reedy
More information about the Python-Dev