New submission from Ben Knight:
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.
----------
messages: 261049
nosy: ben.knight
priority: normal
severity: normal
status: open
title: str.translate() unexpectedly duplicates untranslated characters
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26464>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com