On 27 October 2016 at 00:17, Chris Barker <chris.bar...@noaa.gov> wrote:
> 1) an easy way to spell "remove all the characters other than these"
>
> I think that's a good idea. What with unicode having an enormous number
> of code points, it really does make sense to have a way to specify
> only what you >want, rather than what you don't want.
>
> Back in the good old days of 1-byte chars, it wasn't hard to build up
> a full 256 element translate table -- not so much anymore.
> And one of the whole points of str.translate() is good performance.

Actually even with ASCII (read for python 2.7) I would also be happy
to have such function: say I just want to keep only digits so I write:

digits = "0123456789"
newstring = somestring.keep(digits)

Despite I can do it other way, this would be much simpler and clearer
way to do it. And I suppose it is quite common task not only for me.
Currently 99% of my programs are in python 2.7. And I started to use python 3
only for tasks when I want to process unicode strings (ironically only
to get rid of unicode).


Mikhail
_______________________________________________
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