[Python-Dev] Add transform() and untranform() methods
Antoine Pitrou
solipsis at pitrou.net
Fri Nov 15 11:33:47 CET 2013
On Fri, 15 Nov 2013 21:28:35 +1100
Steven D'Aprano <steve at pearwood.info> wrote:
>
> One benefit is:
>
> import codecs
> codec = get_name_of_compression_codec()
> result = codecs.encode(data, codec)
That's a good point.
> If encoding/decoding is intended to be completely generic (even if 99%
> of the uses will be with strings and bytes), is there any reason to
> prefer built-in functions rather than methods on object?
Practicality beats purity. Personally, I've never used codecs on
anything else than str and bytes objects.
Regards
Antoine.
More information about the Python-Dev
mailing list