Re: strop module and whitespace

Guido.van.Rossum@cwi.nl
Thu, 08 Jul 1993 18:27:53 +0200

Thanks for the feedback. Now if everybody would also mail me their
opinion on the subject of the GREAT RENAMING...

I've chosen the following solution. In the next release of Python,
the built-in module "strop" will export three variables: 'whitespace',
'lowercase' and 'uppercase', constructing by testing isspace(),
islower() and isupper() for all characters in the range 1-255. These
variables are inherited by the library module "string" (and its value
of 'digits' is correctly calculated).

I won't support changing these variables to modify the effect of the
corresponding built-in functions (strip(), split(), lower(), upper()
and swapcase()), since it would slow down their implementation
considerably -- they currently use the macros defined in <ctype.h>.
Of course the implementation could be made more efficient without
losing flexibility, but I personally doubt the usefulness of the
feature (especially since the effect would be global!), and I would
prefer to keep it small and simple.

If you need to have a version of split() that uses a different set of
characters, perhaps you can use regsub.split() instead -- it uses a
compiled regular expression for reasonable efficiency. I might be
convinced that Python can use equivalents of strpbrk(), strspn(),
strcspn() and strtok() though (any other favorite string ops?).

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>