"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > M.-A. Lemburg wrote: > > Just because some codecs don't fit into the string.decode() > > or bytes.encode() scenario doesn't mean that these codecs are > > useless or that the methods should be banned. > > No. The reason to ban string.decode and bytes.encode is that > it confuses users.
How are users confused? bytes.encode CAN only produce bytes. Though string.decode (or bytes.decode) MAY produce strings (or bytes) or unicode, depending on the codec, I think it is quite reasonable to expect that users will understand that string.decode('utf-8') is different than string.decode('base-64'), and that they may produce different output. In a similar fashion, dict.get(1) may produce different results than dict.get(2) for some dictionaries. If some users can't understand this (passing different arguments to a function may produce different output), then I think that some users are broken beyond repair. - Josiah _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com