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

Random832 random832 at fastmail.com
Fri Jan 26 10:16:23 EST 2018


On Fri, Jan 26, 2018, at 09:18, M.-A. Lemburg wrote:
> Is there a way to call an API which fixes the setting
> (a public version of unicode_adjust_maxchar()) ?
> 
> Without this, how would an extension be able to provide a
> correct value upfront without knowing the content ?

It obviously has to know the content before it can finally return the string (or pass it to any other function, etc), because strings are immutable. Why not then do all the intermediate work in an array of int32's (or perhaps a UCS-4 PyUnicode to be returned only if needed), then afterward scan and build the string?


More information about the Python-ideas mailing list