On Wed, Oct 26, 2016 at 5:32 PM, Mikhail V email@example.com wrote:
(b) has the advantage of adding translation and removal in one fell
but if you only want to remove, then you have to make a translation
1:1 mappings = not hard, but a annoying:
Exactly that is the proposal. And for same exact reason that you point out, I also can't give a comment what would be better. It would be indeed quite strange from syntactical POV if I just want to remove "all except" and must call translate(). So ideally both should exist I think.
That kind of violate OWTDI though. Probably one's enough.
and if fact with the use-cases I can think of, and the one you mentioned, they are really two steps: there are the characters you want to translate, and the ones you want to keep, but the ones you want to keep are a superset of the ones you want to translate. so if we added the "remove"option to .translate(), then you would need to add all the "keep" charactors to your translate table.
I'm thinking they really are different operations, give them a different method.