[New-bugs-announce] [issue19621] Reimporting this and str.translate()
Chris Angelico
report at bugs.python.org
Sat Nov 16 05:46:43 CET 2013
New submission from Chris Angelico:
In an interactive session, typing 'import this' a second time doesn't produce output (as the module's already imported). Peeking into the module shows a string and what looks like a translation dictionary, but doing the obvious thing:
>>> this.s.translate(this.d)
doesn't work, because str.translate() expects a dictionary that maps Unicode ordinals, not one-character strings.
Attached is a patch which makes Lib/this.py use s.translate() instead of the wordier comprehension. Dare I ask, is there any possible code that this change could break? :)
----------
components: Library (Lib)
files: this-translate.patch
keywords: patch
messages: 203008
nosy: Rosuav
priority: normal
severity: normal
status: open
title: Reimporting this and str.translate()
type: enhancement
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file32645/this-translate.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19621>
_______________________________________
More information about the New-bugs-announce
mailing list