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

INADA Naoki songofacandy at gmail.com
Fri Jan 26 10:54:16 EST 2018

We have _PyUnicodeWriter for such use cases.
We may able to expose it as public API, but please start another thread
for it.

Unicode created by wrong maxchar is not supported from Python 3.3.
== and hash() doesn't work properly for such unicode object.
So str.isascii() has not to support it too.

> The create, write data, resize approach is a standard way to build
> (longer) Pythhon string objects in the Python C API, since it
> avoids temporary copies.
> E.g. you don't want to first build a buffer to hold 100MB XML,
> then scan it for the max code point being used, create a python
> string from it (which copies the data into a second 100MB
> buffer) and then deallocate the first buffer again.
> Instead you create an uninitialized Python Unicode object
> and use PyUnicde_WRITE() to write the data directly into
> the object, avoiding the 100MB temp buffer.
> PS: Strings are immutable in Python, but they are not in C.
> You can manipulate string objects provided you own the only
> reference.
> --
> Marc-Andre Lemburg
> eGenix.com
> Professional Python Services directly from the Experts (#1, Jan 26 2018)
>>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>>> Python Database Interfaces ...           http://products.egenix.com/
>>>> Plone/Zope Database Interfaces ...           http://zope.egenix.com/
> ________________________________________________________________________
> ::: We implement business ideas - efficiently in both time and costs :::
>    eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>            Registered at Amtsgericht Duesseldorf: HRB 46611
>                http://www.egenix.com/company/contact/
>                       http://www.malemburg.com/
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

INADA Naoki  <songofacandy at gmail.com>

More information about the Python-ideas mailing list