[issue6300] encode and decode should accept 'errors' as a keyword argument

Marc-Andre Lemburg report at bugs.python.org
Fri Sep 18 21:59:22 CEST 2009


Marc-Andre Lemburg <mal at egenix.com> added the comment:

Jeff Bradberry wrote:
> 
> Jeff Bradberry <jeff.bradberry at gmail.com> added the comment:
> 
> Ok, fixed.  I am kind of vague, though, on the usefulness of str.encode
> and unicode.decode.

codecs can work on any combination of types. Here's an example of
a codec that accepts str and unicode and returns str:

'313233'
>>> u'123'.encode('hex')
'313233'
>>> '313233'.decode('hex')
'123'
>>> u'313233'.decode('hex')
'123'

In 3.1 the method don't support this anymore, since they are more
strict w/r to type checking.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6300>
_______________________________________


More information about the Python-bugs-list mailing list