[Python-ideas] Adding str.isascii() ?

Chris Angelico rosuav at gmail.com
Wed Jan 31 09:46:56 EST 2018

On Thu, Feb 1, 2018 at 12:44 AM, Victor Stinner
<victor.stinner at gmail.com> wrote:
> I like the idea of str.isdigit(ascii=True): would behave as
> str.isdigit() and str.isascii(). It's easy to implement and likely to
> be very efficient. I'm just not sure that it's so commonly required?
> At least, I guess that some users can be surprised that str.isdigit()
> is "Unicode aware", accept non-ASCII digits, as int(str).

I disagree; the whole point of "isdigit" is that it catches every
digit. If you want to check against a specific (and small) set of
characters, just use set operations.


More information about the Python-ideas mailing list