New submission from Sergey Fedoseev <fedoseev.ser...@gmail.com>: In [186]: from itertools import cycle
In [187]: class ContainerLike: ...: def __init__(self): ...: self.chars = cycle('12') ...: def __getitem__(self, key): ...: return next(self.chars) ...: In [188]: 'aaaaaa'.translate(ContainerLike()) Out[188]: '111111' In [189]: 'ыыыыыы'.translate(ContainerLike()) Out[189]: '121212 It seems that behavior was changed in https://github.com/python/cpython/commit/89a76abf20889551ec1ed64dee1a4161a435db5b. At least it should be documented. ---------- messages: 336279 nosy: sir-sigurd priority: normal severity: normal status: open title: str.translate() behave differently for ASCII-only and other strings _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36072> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com