On Wed, Oct 26, 2016 at 5:32 PM, Mikhail V <mikhail...@gmail.com> wrote:

> > (b) has the advantage of adding translation and removal in one fell
> swoop --
> > but if you only want to remove, then you have to make a translation
> table of
> > 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.

-CHB

-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to