Message260542
The intended use for str.encode is for same-type transcoding, like this:
I was unaware of the seemingly useless behavior you quote.
>>> 'abc'.encode('base64')
'YWJj\n'
>>> 'YWJj\n'.decode('base64')
'abc'
Here is a similar use for unicode.decode.
>>> u'abc'.encode('base64')
'YWJj\n'
>>> u'YWJj\n'.decode('base64')
'abc'
Any doc change should make the intended use clear if not already.
(Note that the above give lookup errors in 3.x
>>> 'abc'.encode('base64')
...
LookupError: 'base64' is not a text encoding; use codecs.encode() to handle arbitrary codecs) |
|
Date |
User |
Action |
Args |
2016-02-20 00:29:23 | terry.reedy | set | recipients:
+ terry.reedy, ezio.melotti, steven.daprano, docs@python, benspiller |
2016-02-20 00:29:23 | terry.reedy | set | messageid: <1455928163.86.0.214801783855.issue26369@psf.upfronthosting.co.za> |
2016-02-20 00:29:23 | terry.reedy | link | issue26369 messages |
2016-02-20 00:29:23 | terry.reedy | create | |
|