This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients benspiller, docs@python, ezio.melotti, steven.daprano, terry.reedy
Date 2016-02-20.00:29:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1455928163.86.0.214801783855.issue26369@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2016-02-20 00:29:23terry.reedysetrecipients: + terry.reedy, ezio.melotti, steven.daprano, docs@python, benspiller
2016-02-20 00:29:23terry.reedysetmessageid: <1455928163.86.0.214801783855.issue26369@psf.upfronthosting.co.za>
2016-02-20 00:29:23terry.reedylinkissue26369 messages
2016-02-20 00:29:23terry.reedycreate