Understood, and I agree, I have seen someone make a similar argument for using RegEx. Here are my main points...
1) Speed - Built-in's are faster. 2) Standardisation - It is a common task, that has MANY ways of being completed. 3) Frequent Task - It is to my mind as useful as str.strip() or str.replace() .. perhaps a lesser point ... 4) Batteries Included - In this case Python 3 is more obtuse than Python 2 in a task which often showcases Pythons ease of use. (see 'Programming Foundations with Python's' secret message lesson for an example.) Those on this list are the least likely to want this functionality, because each of us could solve this quickly in many different ways, but that doesn't mean we should. It is the tasks we don't think about that i believe often eat up cycles. Like I said, even is this is a bad idea I would like to fully grok why. Thank you all for your time. On 23 October 2016 at 02:45, David B <dwb...@gmail.com> wrote: > I would use list comprehension even if there were some other way to > translate as it is straight forward. > > On 10/22/16, Simon Mark Holland <simonmarkholl...@gmail.com> wrote: > > Having researched this as heavily as I am capable with limited > experience, > > I would like to suggest a Python 3 equivalent to string.translate() that > > doesn't require a table as input. Maybe in the form of str.stripall() or > > str.replaceall(). > > > > My reasoning is that while it is currently possible to easily strip() > > preceding and trailing characters, and even replace() individual > characters > > from a string, to replace more than one characters from anywhere within > the > > string requires (i believe) at its simplest a command like this : > > > > some_string.translate(str.maketrans('','','0123456789')) > > > > In Python 2.* however we could say ... > > > > some_string.translate(None, '0123456789') > > > > My proposal is that if strip() and replace() are important enough to > > receive modules, then the arguably more common operation (in terms of > > programming tutorials, if not mainstream development) of just removing > all > > instances of specified numbers, punctuation, or even letters etc from a > > list of characters should also. > > > > I wholeheartedly admit that there are MANY other ways to do this > (including > > RegEx and List Comprehensions), as listed in the StackOverflow answer > > below. However the same could be said for replace() and strip(). > > http://stackoverflow.com/questions/22187233/how-to- > delete-all-instances-of-a-character-in-a-string-in-python > > > > This is my first suggestion and welcome any and all feedback, even if > this > > is a silly idea I would really like to know why it is. I have not seen > > discussion of this before, but if there is such a discussion I would > > welcome being directed to it. > > > > Thank you for your time. > > Simon > > > > > -- > With the simplicity of true nature, there shall be no desire. > Without desire, one's original nature will be at peace. > And the world will naturally be in accord with the right Way. Tao Te Ching > -- Simon Holland BA Hons Medan, Indonesia -------------------- Mobile : +62 81 26055297 Fax : +62 81 6613280 [image: Twitter] <http://twitter.com/SimonMarkHollan> [image: LinkedIn] <http://id.linkedin.com/in/simonmarkholland> [image: YouTube] <http://www.youtube.com/simonmarkholland> [image: Google Talk] <simonmarkholl...@gmail.com>
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/