On Fri, 15 Nov 2013 21:28:35 +1100 Steven D'Aprano <st...@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. _______________________________________________ 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