Author ben.knight
Recipients ben.knight
Date 2016-03-01.13:51:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1456840304.03.0.420145350869.issue26464@psf.upfronthosting.co.za>
In-reply-to
Content
Python 3.5.1 x86-64, Windows 10

I created a translation map that translated some characters to None and others to strings and found that in some cases str.translate() will duplicate one of the untranslated characters in the returned string.

How to reproduce:

table = str.maketrans({'a': None, 'b': 'cd'})
'axb'.translate(table)

Expected result:

'xcd'

Actual result:

'xxcd'

Mapping 'a' to '' instead of None will produce the desired effect.
History
Date User Action Args
2016-03-01 13:51:44ben.knightsetrecipients: + ben.knight
2016-03-01 13:51:44ben.knightsetmessageid: <1456840304.03.0.420145350869.issue26464@psf.upfronthosting.co.za>
2016-03-01 13:51:43ben.knightlinkissue26464 messages
2016-03-01 13:51:43ben.knightcreate