[Python-ideas] Adding str.isascii() ?
chris.barker at noaa.gov
Tue Jan 30 12:28:00 EST 2018
On Tue, Jan 30, 2018 at 12:00 AM, Steven D'Aprano <steve at pearwood.info>
> > But it's also a readability question: "is_ascii()" and
> > "is_UCS2()/is_BMP()" just require knowing what 7-bit ASCII and UCS-2
> > (or the basic multilingual plane) *are*, whereas the current ways of
> > checking for them require knowing how they *behave*.
This is important.
Agreed with all of those.
> However, given how niche the varieties other than is_ascii() are, I'm
> not going to push for them. I use them rarely enough, or on small enough
> strings, that doing an O(N) max(string) is not that great a burden.
sure, but adding is_ascii() and is_bmp() are pretty small additions as
well. I"d say for the newbiew among us, it would be a nice feature:
As for is_bmp() -- yes, UCS-2 is "deprecated", but there are plenty of
systems that don't handle UTF-16 well, so it's nice to know, and not hard
I also think a UCS-2 encoding would be handy -- but I won't personally use
it, so I'll wait for someone that has a use case to ask for it.
Christopher Barker, Ph.D.
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.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas