Message 336279 - Python tracker

Message336279

Author sir-sigurd
Recipients sir-sigurd
Date 2019-02-22.05:34:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550813669.37.0.821443537849.issue36072@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-02-22 05:34:29sir-sigurdsetrecipients: + sir-sigurd
2019-02-22 05:34:29sir-sigurdsetmessageid: <1550813669.37.0.821443537849.issue36072@roundup.psfhosted.org>
2019-02-22 05:34:29sir-sigurdlinkissue36072 messages
2019-02-22 05:34:29sir-sigurdcreate